본문 바로가기

HackerRank

[HackerRank - SQL] 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. Your result cannot contain duplicates.

 

테이블 구조

풀이

  • Weather Observation Station 9번 문제10번 문제의 답안을 조합하기만 하면 되는 문제였다.
  • 풀이는 위 두 개의 링크를 참고하면 된다.
SELECT DISTINCT CITY
FROM STATION
WHERE CITY REGEXP '^[^aeiouAEIOU].*'
OR CITY REGEXP '.*[^aeiouAEIOU]$'