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:
* even : 짝수 (2로 나누었을 때 나머지가 0인 수)
* odd : 홀수 (2로 나누었을 때 나머지가 1인 수)
where LAT_N is the northern latitude and LONG_W is the western longitude.
SELECT
DISTINCT CITY
FROM STATION
WHERE
MOD(ID, 2) = 0;
나머지 함수
- %, mod
SELECT MOD(18, 4);
-- 2
SELECT 18 % 5;
-- 3
몫 함수
- div
SELECT 10 DIV 3;
-- 3
'SQL > HackerRank' 카테고리의 다른 글
[MySQL/HackerRank] Weather Observation Station 5 (0) | 2024.08.11 |
---|---|
[MySQL/HackerRank] Weather Observation Station 4 (0) | 2024.08.11 |
[MySQL/HackerRank] Weather Observation Station 1 (0) | 2024.08.11 |
[MySQL/HackerRank] Japanese Cities' Names (0) | 2024.08.11 |
[MySQL/HackerRank] Select By ID (0) | 2024.08.11 |