Sort 650 Discussions, By:
Please Login in order to post a comment
This is a terribly worded question. Here is how it should have been phrased -
Write a query to find the difference between the total number of cities and the unique number of cities in the table STATION.
I don't understand why he says "Let's say" and gives all NUM etc.
Here problem statement itself is a problem.
SELECT COUNT(CITY) - COUNT(DISTINCT CITY) FROM STATION;
worked for me.
select (count(CITY)-COUNT(DISTINCT CITY)) from STATION;
Here is Oracle solution from my HackerrankPractice repository:
SELECT COUNT(CITY) - COUNT(DISTINCT CITY)
Feel free to ask if you have any questions :)