[MySQL] HackerRank - Weather Observation Station 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.
์ ๋ต
๋ฌธ์ ์์ ๋นจ๊ฐ์์ผ๋ก ํ์ํด๋ ๋ถ๋ถ์ ๋ณด์. "EVEN" ID NUMBER... ์ง์๋ฅผ ๋ปํ๋ค๊ณ ํ๋ค.ใ ใ ใ ใ ใ EVEN NUMBER / ODD NUMBER ์ด๊ฑฐ!!! ์ด๊ฑฐ ์บ์น ๋ชปํด์ ๋ฌธ์ ๋ฅผ ๋ชป์์๋ฃ๊ณ , ํํ๊ณ ๋ฒ์ญ์ ๋๋ ธ๋๋ฐ ํด์์ ์ด์ํ๊ฒ ํ๋ ๋ฐ๋์ ํ๋์ CITY์ง๋ง ๋๊ฐ ์ด์์ ID๋ฅผ ๊ฐ๋ ๊ฒ๋ค์ ์ฐพ๊ณ ์์๋ค... ๋น์ฐํ ์ค๋ต์ผ์๋ฐ์...
์ง์์ธ ์์ด๋๋ฅผ ์ฐพ๊ธฐ ์ํด ๋๋๊ธฐ(%) ์ฐ์ฐ์๋ฅผ ์ฌ์ฉํ๋ค. ํ์ด์ฌ๊ณผ ๋์ผํ๊ฒ (%๋ ๋๋จธ์ง๊ฐ์ถ๋ ฅ๋๊ณ , /๋ ๋ชซ์ด ํํ๋๋ค. ๋จ MYSQL์์๋ ๋ชซ๋ง๊ณ ์์ซ์ ์ผ๋ก ๋๋ ์ง ์ ํํ ๊ฐ์ด ํํ๋๋ค.)
SELECT DISTINCT CITY
FROM STATION
WHERE (ID%2) = 0