Sort 1247 Discussions, By:
Please Login in order to post a comment
Crappy description, Author must try and be more clear about using even number as ID Column.
for ORACLE => SELECT DISTINCT(CITY) FROM STATION WHERE MOD(ID,2)=0 ;
for MySQL => SELECT DISTINCT(CITY) FROM STATION WHERE (ID%2)=0 ;
Here is Oracle solution from my HackerrankPractice repository:
SELECT DISTINCT CITY
WHERE MOD(ID, 2) = 0;
Feel free to ask if you have any questions :)
Although its simple, but may take a lot of your time to understand the syntax of MOD operator if you're a beginner at SQL
SELECT DISTINCT CITY FROM STATION WHERE MOD(ID,2)=0;
I've been stucked for a while due to this part after the station table, which is not evaluated in the rigth answer query:
"where LAT_N is the northern latitude and LONG_W is the western longitude"
For the rigth answer you only need to attain to the even ID number.