본문 바로가기
데이터/SQL 문제풀이

[MySQL] HackerRank SQL - Weather Observation Station 10

by 찌노오 2022. 10. 20.

 

 

Problem

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

Input Format

The STATION table is described as follows:

where LAT_N is the northern latitude and LONG_W is the western longitude. 

 

STATION의 테이블에서 모음으로 끝나지 않는 CITY명만 출력하라.

단, 중복은 제외하라.


Answer1

SELECT CITY
FROM STATION
WHERE RIGHT(CITY,1) NOT IN ('a','e','i','o','u')
GROUP BY CITY

 

 

 


How to solve

다른 방법 많지만, 몇 달 쉬다가 풀려고 하니 이런 방법도 떠올랐다.

그냥 맨 끝 문자 추출해서 필터걸면 되겠구나.

하지만, 성능은 보장하지 못한다.

 

추가) 11/12는 같은 내용의 반복이라 패스하겠다.

 

 

 

 

 

반응형

댓글