Prepare > SQL > Basic Select > Weather Observation Station 7

2023. 7. 10. 21:37HackerRank-My SQL

 

Weather Observation Station 7 | HackerRank

Query the list of CITY names ending with vowels (a, e, i, o, u) from STATION.

www.hackerrank.com

 

문제


Query the list of CITY names ending with vowels (a, e, i, o, u) from STATION. Your result cannot contain duplicates.

 

 

 

 

코드


SELECT DISTINCT(CITY) FROM STATION
WHERE RIGHT(CITY,1) REGEXP "A|E|I|O|U";

 

 

 

 

노트


SELECT DISTINCT(CITY) FROM STATION
WHERE RIGHT(CITY, 1) = 'A'
    OR RIGHT(CITY, 1) = 'E'
    OR RIGHT(CITY, 1) = 'U'
    OR RIGHT(CITY, 1) = 'I'
    OR RIGHT(CITY, 1) = 'O';