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
|
1454 Discussions
|
Please Login in order to post a comment
SELECT COUNT(CITY) - COUNT(DISTINCT CITY) FROM STATION
SELECT COUNT(CITY) - COUNT(DISTINCT CITY) FROM STATION AS DIFFERENCE;
Hello here is the code to solve the problem
there are two ways to compute the difference between: 1. total number of CITY entries (including duplicates) 2. number of distinct CITY entries.
Assuming the table is named STATION and the column is CITY First method: 1. SQL to get the difference directly
Second method: 2.If you want to see the two counts separately (total vs distinct) and compute the difference in a single result:
SELECT COUNT(CITY) - COUNT(DISTINCT CITY) AS difference FROM STATION;
SELECT (count(city) - count(distinct city)) AS CITY from station
SELECT COUNT(CITY) - COUNT(DISTINCT CITY) FROM STATION;