본문 바로가기
서버/MYSQL

[MYSQL] HACKERRANK - Weather Observation Station 3

by HDobby 2022. 6. 3.

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

문제

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:

where LAT_N is the northern latitude and LONG_W is the western longitude.

 

생각해보기

ID가 짝수

순서는 아무렇게나

DISTINCT를 이용하여 중복 제거

 

코드

더보기
SELECT DISTINCT(CITY)
FROM STATION
WHERE ID % 2 = 0;

 

728x90

댓글