I have the following data given, what I am trying to do is to find if the cardinality between name and id is 1:1
Sample Data:
Id Name
1 ABC
2 PQR
1 XYZ
4 ABC
90 PQR
100 LMN
30 DEF
Example: I want to detect the following problems: 1) Id "1" maps to more than one names ("ABC", LMN") 2) Name "PQR" corresponds to more than one Ids ("2", "90") 3) Name "ABC" corresponds to more than one Ids ("1", "4")
SELECT COUNT(Id) AS IdCount,
Count(Name) AS NameCount
FROM InputData;
However, this will not tell me the answer I want, since there could be equal number of unique ids and names and still have more than one mapping among them. I don't care about duplicates for eg. if "1" corresponds to "ABC" multiple times, that should be okay.