Difference between total number of rows and distinct rows in sql server
Answers
Answered by
4
I'm new to SQL, wasn't able to write the correct SQL. Given a table STATION that holds data for five fields namely ID, CITY, STATE, NORTHERN LATITUDE and WESTERN LONGITUDE.
+-------------+------------+ | Field | Type | +-------------+------------+ | ID | INTEGER | | CITY | VARCHAR(21)| | STATE | VARCHAR(2) | | LAT_N | NUMERIC | | LONG_W | NUMERIC | +-------------+------------+
Let NUM be the number of cities and NUMunique be the number of unique cities, then write a query to print the value of NUM - NUMunique.
+-------------+------------+ | Field | Type | +-------------+------------+ | ID | INTEGER | | CITY | VARCHAR(21)| | STATE | VARCHAR(2) | | LAT_N | NUMERIC | | LONG_W | NUMERIC | +-------------+------------+
Let NUM be the number of cities and NUMunique be the number of unique cities, then write a query to print the value of NUM - NUMunique.
Similar questions
Math,
7 months ago
World Languages,
7 months ago
Music,
7 months ago
Business Studies,
1 year ago
Physics,
1 year ago
History,
1 year ago