CODING TEST/SQL : HackerRank

[MySQL] Weather Observation Station 11

주 녕 2021. 4. 7. 01:03
반응형

▶  SQL  >  Basic Select  > Weather Observation Station 11 

 Problem 

Query the list of CITY names from STATION that either do not start with vowels or do not end with vowels. Your result cannot contain duplicates.

The STATION table is described as follows:

→ 모음으로 시작하지 않거나 모음으로 끝나지 않는 CITY names, 중복X

 

 My Answer 

SELECT DISTINCT CITY
FROM STATION
WHERE CITY REGEXP '^[^aeiou]' OR CITY REGEXP '[^aeiou]$'

 

* REGEXP에 대한 내용은 Weather Observation Station 6 포스팅 참고

 

 

 

[MySQL] Weather Observation Station 6

SQL > Basic Select > Weather Observation Station 6  Problem Query the list of CITY names starting with vowels (i.e., a, e, i, o, or u) from STATION. Your result cannot contain duplicates...

junyoung-developer.tistory.com

 

반응형