SQL 문제풀이

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

냄비짱 2023. 8. 18. 22:04
728x90

❓ Question

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

 

Weather Observation Station 11 | HackerRank

Query a list of CITY names not starting or ending with vowels.

www.hackerrank.com

❗ Answer

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

📌 Discussion

- WHERE에 OR로 합집합 조건을 걸어줌