https://www.hackerrank.com/challenges/weather-observation-station-6
SELECT DISTINCT city
FROM station
WHERE city LIKE 'a%'
OR city LIKE 'e%'
OR city LIKE 'i%'
OR city LIKE 'o%'
OR city LIKE 'u%'
패턴을 찾을 때는 WHERE절에 LIKE 연산
을 사용한다.
자주 사용되는 와일드카드
https://www.hackerrank.com/challenges/weather-observation-station-7
SELECT DISTINCT city
FROM station
WHERE city LIKE '%a'
OR city LIKE '%e'
OR city LIKE '%i'
OR city LIKE '%o'
OR city LIKE '%u'
🔁 정규표현식으로 접근해보기(6~11)
https://www.hackerrank.com/challenges/weather-observation-station-8
SELECT DISTINCT city
FROM station
WHERE city REGEXP '^[aeiou].*[aeiou]$'
LEFT(string, number_of_chars)
/ RIGHT( )
함수 사용SELECT DISTINCT city
FROM station
WHERE LEFT(city, 1) IN ('a', 'e', 'i', 'o', 'u')
AND RIGHT(city, 1) IN ('a', 'e', 'i', 'o', 'u')
https://www.hackerrank.com/challenges/weather-observation-station-9
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%'
7번문제와 비교. 조건에서 AND / OR 생각하기