Posts

Showing posts with the label Find the difference between the total number of CITY entries in the table and the number of distinct CITY entries in the table.

Find the difference between the total number of CITY entries in the table and the number of distinct CITY entries in the table.

Image
  The   STATION   table is described as follows: SOLUTION: SELECT COUNT(CITY)-COUNT(DISTINCT CITY) FROM STATION; Explanation: COUNT(*) counts all rows (including duplicates and nulls in other columns, but not in CITY directly). COUNT(DISTINCT CITY) counts unique cities only . Subtracting the two gives you the number of duplicate city entries .