CODING TEST/SQL : HackerRank

[MySQL] Weather Observation Station 8

주 녕 2021. 4. 3. 04:28
반응형

▶  SQL  >  Basic Select  > Weather Observation Station 8 

 Problem 

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. Your result cannot contain duplicates.

The STATION table is described as follows:

 My Answer 

SELECT DISTINCT CITY
FROM STATION
WHERE CITY REGEXP '^[aeiou]' AND CITY REGEXP '[aeiou]$'

 

* REGEXP에 대한 내용은 Weather Observation Station 6 포스팅 참고

반응형