[SQL] Weather Observation Station 3

순동·2022년 4월 11일

✅ Weather Observation Station 3


📝 문제

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:


💻 풀이

SELECT DISTINCT(CITY) FROM STATION WHERE MOD(ID, 2) != 1;

📌 정리

  • MOD(ID, 2) != 1 : ID를 2로 나눈 나머지가 0인 것. 즉, 짝수
  • DISTINCT(CITY) : 중복을 제거

0개의 댓글