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는 같은 내용의 반복이라 패스하겠다.
반응형
'데이터 > SQL 문제풀이' 카테고리의 다른 글
HackerRank SQL - Higher Than 75 Marks (0) | 2022.11.01 |
---|---|
HackerRank SQL - The Blunder (0) | 2022.11.01 |
HackerRank SQL - Weather Observation Station 9 (0) | 2022.06.21 |
HackerRank SQL - Weather Observation Station 8 (0) | 2022.06.18 |
HackerRank SQL - Weather Observation Station 7 (0) | 2022.06.17 |
댓글