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.
Input Format
The STATION table is described as follows:
where LAT_N is the northern latitude and LONG_W is the western longitude.
[My Answer]
1
2
3
4
|
SELECT DISTINCT city
FROM station
WHERE city REGEXP "^[aeiou].*[aeiou]$";
|
cs |
I had trouble understanding REGEXP, but after visit this blog, I got it right away...
mysql regexp : 복잡한 패턴 매칭을 해 봅시다.
저번에 LIKE 연산자를 배웠습니다. 이번에는 조금 더 복잡한 패턴 매칭에 대해서 다뤄보겠습니다. [관련글] LIKE 연산자 알아봅시다. 눈치 채신 분도 있으실지 모르겠습니다. 자바에서 파싱할
codingdog.tistory.com
Thanks alot.
'Code Problems > SQL_ HackerRank' 카테고리의 다른 글
[HackerRank] Weather Observation Station 10 (0) | 2021.07.01 |
---|---|
[HackerRank] Weather Observation Station 9 (0) | 2021.05.01 |
[HackerRank] Weather Observation Station 7 (0) | 2021.04.18 |
[HackerRank] Weather Observation Station 6 (0) | 2021.04.17 |
[Hacker Rank] Weather Observation Station 5 (0) | 2021.04.17 |