https://www.hackerrank.com/challenges/weather-observation-station-7/problem
코드설명
REGEXP_LIKE + LIKE + LOWER 를 활용합니다.
ORACLE 코드
REGEXP_LIKE에서 $ 정규표현식을 이용해 해당 값들이 맨 마지막에 있다는 것을 표현합니다.
SELECT DISTINCT CITY
FROM STATION
WHERE REGEXP_LIKE(CITY, '(a|e|i|o|u)$', 'i');
LIKE를 활용할 경우
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'
OR CITY LIKE '%A'
OR CITY LIKE '%E'
OR CITY LIKE '%I'
OR CITY LIKE '%O'
OR CITY LIKE '%U';
LIKE+ LOWER를 활용할경우
SELECT DISTINCT CITY
FROM STATION
WHERE LOWER(CITY) LIKE '%a'
OR LOWER(CITY) LIKE '%e'
OR LOWER(CITY) LIKE '%i'
OR LOWER(CITY) LIKE '%o'
OR LOWER(CITY) LIKE '%u';