코드 공부
[오늘의 코드 131] [HackerRank] Weather Observation Station 11
eun_00
2024. 10. 30. 21:53
[문제]
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.
Input Format
The STATION table is described as follows:

where LAT_N is the northern latitude and LONG_W is the western longitude.
[💡 정답]
SELECT DISTINCT CITY
FROM STATION
WHERE LOWER(SUBSTRING(CITY, 1, 1)) NOT IN ('a', 'e', 'i', 'o', 'u')
OR LOWER(SUBSTRING(CITY, -1, 1)) NOT IN ('a', 'e', 'i', 'o', 'u');
✔️ 알게된 것
- 앞글자로 시작하는 것 또는 뒤로 끝마치는 것 SUBSTRING(변수명, 시작 위치, 시작위치로부터 몇번째까지) 함수사용