SQL 문제풀이

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

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

❓ Question

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

 

Weather Observation Station 12 | HackerRank

Query an alphabetically ordered list of CITY names not starting and ending with vowels.

www.hackerrank.com

❗ Answer

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

📌 Discussion

- WHERE절에서 AND로 교집합 조건을 걸어줌