SQL/MySQL 문제풀이
Weather Observation Station 6(HackerRank)
관재탑
2022. 7. 18. 15:24
https://www.hackerrank.com/challenges/weather-observation-station-6/problem?isFullScreen=true
Weather Observation Station 6 | HackerRank
Query a list of CITY names beginning with vowels (a, e, i, o, u).
www.hackerrank.com
문제
Query the list of CITY names starting with vowels (i.e., a, e, i, o, or u) from STATION. Your result cannot contain duplicates.
정답 쿼리
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%'
해설
1. SELECT DISTINCT는 중복된 값을 빼준다.