~고군분투 인생살이~

[EASY] Weather Observation Station 7 본문

SQL/HACKER_RANK

[EASY] Weather Observation Station 7

소금깨 2022. 10. 26. 03:13
 

Weather Observation Station 7 | HackerRank

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

www.hackerrank.com

문제 조건

끝 글자가 a,e,i,o,u를 가지는 city 이름을 유니크하게 출력하시오 

 

문제 풀이 

# solution 1 
select distinct city
from station
where city regexp '[a,e,i,o,u]$'

# solution 2 
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'

'SQL > HACKER_RANK' 카테고리의 다른 글

[MEDIUM] The Report  (0) 2022.10.26
[EASY] Weather Observation Station 8  (0) 2022.10.26
[EASY] Weather Observation Station 6  (0) 2022.10.26
[Medium] Weather Observation Station 20  (0) 2022.10.24
[Medium] Weather Observation Station 19  (0) 2022.10.24
Comments