[SQL] HackerRank )Weather Observation Station 6

도리·2025년 3월 6일


오늘부터 hacker rank 문제풀이!

문제

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

내 풀이

select city
from station 
where (city like 'a%') or (city like 'e%') or
      (city like 'i%') or (city like 'o%') or (city like 'u%')

다른 사람 풀이

SELECT DISTINCT CITY
FROM STATION
WHERE LEFT(CITY, 1) IN ('a','e','i','o','u');

맞긴했는데 중복 안봐준다했으니까 나도 distinct를 했었어야 했나보다.

profile
인공지능응용학과 졸업예정..

0개의 댓글