๋ฐ์ํ
๋ฌธ์
https://www.hackerrank.com/challenges/weather-observation-station-9/problem
Query the list of CITY names from STATION that do not start with vowels. Your result cannot contain duplicates.
Input Format
The STATION table is described as follows:
where LAT_N is the northern latitude and LONG_W is the western longitude.
์ ๋ต
SELECT DISTINCT CITY
FROM STATION
WHERE CITY NOT LIKE 'A%'
AND CITY NOT LIKE 'E%'
AND CITY NOT LIKE 'I%'
AND CITY NOT LIKE 'O%'
AND CITY NOT LIKE 'U%'
์ฌ๊ธฐ์ AND ๊ฐ ์๋๋ผ OR์ ์จ์ ์๊ฐ์ ๋บ๊ฒผ๋ค. NOT LIKE๋๊น AND๋ก ์ฐ๊ฒฐํด์ฃผ๋๊ฒ ๋ง๋ค.... A๋ก ์์ํ์ง๋ ์๊ณ , E๋ก ์์ํ์ง๋ ์๊ณ ... ์ด๋ ๊ฒ ๋๋ ๊ฑฐ๋๊น!
์ด์ ์์์ ๋ฐฐ์ ๋ ์ ๊ท์์ ํ์ฉํด์ ๋ค์ ํ์ด๋ณด๊ฒ ๋ค.
SELECT DISTINCT CITY
FROM STATION
WHERE CITY NOT REGEXP '^[aeiou]'
-- ^๋ ์์์ ์๋ฏธ!! AEIOU๋ก ์์ํ์ง ์๋ ๊ฒ์ ๊ณจ๋ผ๋ผ
๋ฐ์ํ
'Algorithm > SQL Query test' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[MySQL] The PADS (0) | 2021.07.22 |
---|---|
[MySQL] HackerRank - Weather Observation Station 10 (0) | 2021.07.22 |
[MySQL] HackerRank - Weather Observation Station 8 (0) | 2021.07.22 |
[MySQL] HackerRank - Weather Observation Station 7 (0) | 2021.07.22 |
[MySQL] HackerRank - Weather Observation Station 6 (0) | 2021.07.22 |