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 3
Weather Observation Station 3
Sort by
recency
|
1717 Discussions
|
Please Login in order to post a comment
SELECT DISTINCT CITY FROM STATION WHERE MOD(ID, 2) = 0;
Can anyone point out my mistake
SELECT CITY, CASE WHEN RIGHT(ID,1) IN (0,2,4,6,8) THEN "EVEN" ELSE "ODD" END AS "E/O" FROM STATION WHERE E/O = "EVEN";
Correct Answer is: SELECT DISTINCT CITY FROM STATION WHERE MOD(ID,2) = 0;
Also you can use this: SELECT DISTINCT CITY FROM STATION WHERE ID%2 = 0;
But because of hackerank test cases, it's not working here.
SELECT DISTINCT CITY, FROM STATION WHERE (ID%2) = 0
FOR MYSQL why is the code not excuting
SELECT DISTINCT City FROM Stations WHERE ID % 2 = 0;
We need to use 'DISTINCT' function because the results must not duplicate.