링크
https://www.hackerrank.com/challenges/weather-observation-station-8/problem?isFullScreen=true
문제
Query the list of CITY names from STATION which have vowels (i.e., a, e, i, o, and u) as both their first and last characters. Your result cannot contain duplicates.
정답
select distinct city
from station
where left(city, 1) in('a', 'e', 'i', 'o', 'u')
and right(city, 1) in('a', 'e', 'i', 'o', 'u')
새롭게 이해한 내용
- left(컬럼, 위치)의 문자를 선택할 수 있다.
- right(컬럼, 위치)의 문자를 선택할 수 있다.
'[업무 지식] > MySQL' 카테고리의 다른 글
[MAX() over()] Challenges (0) | 2024.11.29 |
---|---|
[row index] Weather Observation Station 20 (0) | 2024.11.25 |
[REGEXP] Find Users With Valid E-Mails (0) | 2024.11.18 |
[GROUP_CONCAT] Group Sold Products By The Date (0) | 2024.11.18 |
[Limit/Offset] Second Highest Salary (0) | 2024.11.18 |