Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- leetcode
- L1정규화
- 교차 엔트로피
- 선형 모형
- github
- HTML
- 온라인협업
- 클라우드컴퓨팅
- coding
- conflict
- programmers
- AWS
- CSS
- sql
- elastic net
- RLIKE
- branch
- L2정규화
- merge
- 코딩공부
- 편향-분산 교환
- full request
- Git
- mysql
- PYTHON
- hackerrank
- window function
- early stopping
- 버전충돌
- 깃헙협업
Archives
- Today
- Total
Im between cherry
Hackerrank | MySQL | Weather Observation Station 8 본문
Weather Observation Station 8
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.
- Solution
SELECT DISTINCT CITY
FROM station
WHERE SUBSTR(CITY,1,1) IN ('a','e','i','o','u') AND CITY LIKE '%a' or
SUBSTR(CITY,1,1) IN ('a','e','i','o','u') AND CITY LIKE '%e' or
SUBSTR(CITY,1,1) IN ('a','e','i','o','u') AND CITY LIKE '%i' or
SUBSTR(CITY,1,1) IN ('a','e','i','o','u') AND CITY LIKE '%o' or
SUBSTR(CITY,1,1) IN ('a','e','i','o','u') AND CITY LIKE '%u';
SELECT DISTINCT City
FROM Station
WHERE City rlike '^[AEIOUaeiou].*[aeiou]$'
SELECT Distinct City
FROM Station
WHERE City rLike '^[aeiou]'
AND City rLike '[aeiou]$'
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')
'데이터분석 > practice_query' 카테고리의 다른 글
Hackerrank | MySQL | Weather Observation Station 10 (0) | 2020.08.28 |
---|---|
Hackerrank | MySQL | Weather Observation Station 9 (0) | 2020.08.28 |
Hackerrank | MySQL | Weather Observation Station 7 (0) | 2020.08.27 |
Hackerrank | MySQL | Weather Observation Station 6 (0) | 2020.08.27 |
Hackerrank | MySQL | Weather Observation Station 5 (0) | 2020.08.27 |
Comments