DevHyun

Weather Observation Station 3 본문

SQL/HACKERRANK

Weather Observation Station 3

D3V3L0P3R 2020. 10. 29. 13:58

www.hackerrank.com/domains/sql

 

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.

 

짧은 영어실력으로 번역하자면..

STATION 테이블의 CITY 필드를 추출해 내는 것이 목표이고, 조건은 ID가 EVEN(짝수) 일 것.

정렬 순서는 상관없고 중복제거

 

 

MSSQL

 

SELECT DISTINCT CITY
FROM STATION
WHERE ID%2 = 0

 

나머지 연산자는 %이고 중복제거는 DISTINCT를 사용하였다.

'SQL > HACKERRANK' 카테고리의 다른 글

Occupations  (0) 2020.11.03
Print Prime Numbers  (0) 2020.10.29
Draw The Triangle 1  (0) 2020.10.29
Weather Observation Station 5  (0) 2020.10.29
Weather Observation Station 4  (0) 2020.10.29
Comments