본문 바로가기

SQL/HackerRank

[MySQL/HackerRank] Weather Observation Station 3

Question

Query a list of CITY names from STATION for cities that have an even ID number. Print the results in any order, but exclude duplicates from the answer.
The STATION table is described as follows:

My Answer

SELECT DISTINCT CITY
FROM STATION
WHERE ID%2 = 0;

Note

EVEN : 짝수
ODD : 홀수 

Result

출처 : https://www.hackerrank.com/challenges/weather-observation-station-3/problem

 

Weather Observation Station 3 | HackerRank

Query a list of unique CITY names with even ID numbers.

www.hackerrank.com