We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Weather Observation Station 4
Weather Observation Station 4
Sort by
recency
|
1378 Discussions
|
Please Login in order to post a comment
For MySQL
select count(city)-count(DISTINCT city) from STATION;
COUNT () is the aggregate Funtion that used to count the number of rows in a table.
COUNT(city) will count the number of row If it has city column and has value. If the city name is repeated in any row that also be counted .
COUNT (DISTINCT city) count the number of row in which has the city column but did not count that row in which the city value is repeated.
SELECT count(city) - count(DISTINCT city) FROM STATION;
MSSQL
SELECT COUNT(CITY) - COUNT(DISTINCT CITY) FROM STATION;
I missed only the last semicolon as the description was, everything seems Okay.