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.
Let me explain this for MySQL. For this question you actually need three answers so you will have to write SELECT three times. And two of those times are their own queries so you have to write almost the full syntax besides the ending ; while the last is just a calculation you can just write SELECT and the - operator. So this is how you write it.
SELECT (SELECT COUNT(city) FROM STATION) - (SELECT COUNT(DISTINCT CITY) FROM STATION);
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Weather Observation Station 4
You are viewing a single comment's thread. Return to all comments →
Let me explain this for MySQL. For this question you actually need three answers so you will have to write SELECT three times. And two of those times are their own queries so you have to write almost the full syntax besides the ending ; while the last is just a calculation you can just write SELECT and the - operator. So this is how you write it.
SELECT (SELECT COUNT(city) FROM STATION) - (SELECT COUNT(DISTINCT CITY) FROM STATION);