SQL 문제풀이

[해커랭크 SQL] Basic Select - Weather Observation Station 8

냄비짱 2023. 8. 18. 21:52
728x90

❓ Question

https://www.hackerrank.com/challenges/weather-observation-station-8

 

Weather Observation Station 8 | HackerRank

Query CITY names that start AND end with vowels.

www.hackerrank.com

❗ Answer

SELECT DISTINCT(city)
    FROM station
    WHERE (LEFT(city,1) IN ('a','e','i','o','u'))
           AND (RIGHT(city,1) IN ('a','e','i','o','u'));

📌 Discussion

- WHERE 절에서 LEFT와 RIGHT 조건을 AND로 동시 만족 시키는 레코드만 추출