-- 01. Weather Observation Station 6
https://www.hackerrank.com/challenges/weather-observation-station-6
Query the list of CITY names starting with vowels (i.e., a, e, i, o, or u) from STATION.
SELECT DISTINCT city
FROM station
WHERE city REGEXP '^[aeiou].*'
^ 여기서부터 [ ] 안의 문자가 시작됨
.* 뒤에 아무거나 와도 상관없음 (LIKE 함수의 %와 같은 역할)
-- 02. Weather Observation Station 7
https://www.hackerrank.com/challenges/weather-observation-station-7
Query the list of CITY names ending with vowels (a, e, i, o, u) from STATION.
SELECT DISTINCT city
FROM station
WHERE city REGEXP '.*[aeiou]$'
$ [ ] 안의 문자로 끝나야 함
-- 03. Weather Observation Station 8
https://www.hackerrank.com/challenges/weather-observation-station-8
Query the list of CITY names from STATION which have vowels (i.e., a, e, i, o, and u) as both their first and last characters.
SELECT DISTINCT city
FROM station
WHERE city REGEXP '^[aeiou].*[aeiou]$'
^[aeiou] 맨 앞글자가 [ ] 안의 문자들이고,
.* 중간은 어떤 것이 와도 상관없고
[aeiou]$ 맨 뒷글자가 [ ] 안의 문자들이어야 한다
-- 04. Weather Observation Station 9
https://www.hackerrank.com/challenges/weather-observation-station-9
Query the list of CITY names from STATION that do not start with vowels.
SELECT DISTINCT city
FROM station
WHERE city NOT REGEXP '^[a,e,i,o,u].*'
~이 아니다로 부정할때는 REGEXP 함수 앞에 NOT을 써준다
(LIKE 함수의 NOT LIKE와 비슷한 활용)
-- 05. Weather Observation Station 10
https://www.hackerrank.com/challenges/weather-observation-station-10
Query the list of CITY names from STATION that do not end with vowels.
SELECT DISTINCT city
FROM station
WHERE city NOT REGEXP '.*[aeiou]$'
-- 06. Weather Observation Station 11
https://www.hackerrank.com/challenges/weather-observation-station-11
Query the list of CITY names from STATION that either do not start with vowels or do not end with vowels.
SELECT DISTINCT city
FROM station
WHERE city NOT REGEXP '^[aeiou].*'
OR city NOT REGEXP '.*[aeiou]$'
either이라는 조건이 있으므로 맨 앞글자가 모음으로 시작하지 않고
모음으로 끝나지 않는 조건을 OR로 연결시켜준다.