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
- coding
- full request
- leetcode
- 선형 모형
- 온라인협업
- AWS
- conflict
- 깃헙협업
- L1정규화
- RLIKE
- HTML
- CSS
- mysql
- Git
- programmers
- PYTHON
- 편향-분산 교환
- L2정규화
- 클라우드컴퓨팅
- elastic net
- sql
- merge
- 코딩공부
- 버전충돌
- 교차 엔트로피
- github
- early stopping
- window function
- branch
- hackerrank
Archives
- Today
- Total
Im between cherry
Hackerrank | MySQL | Weather Observation Station 6 본문
Weather Observation Station 6
Weather Observation Station 6 | HackerRank
Query a list of CITY names beginning with vowels (a, e, i, o, u).
www.hackerrank.com
Query the list of CITY names starting with vowels (i.e., a, e, i, o, or u) from STATION. Your result cannot contain duplicates.
Input Format
The STATION table is described as follows:
Solution
-- RLIKE 사용
SELECT DISTINCT city
FROM station
WHERE city RLIKE '^[aeiou]'
-- LIKE사용
SELECT DISTINCT(city)
FROM station
WHERE city LIKE 'a%'
OR city LIKE 'e%'
OR city LIKE 'i%'
OR city LIKE 'o%'
OR city LIKE 'u%'
-- SUBSTRING 사용
SELECT DISTINCT city
FROM station
WHERE SUBSTRING(city, 1, 1) in ('a','e','i','o','u')
'데이터분석 > practice_query' 카테고리의 다른 글
Hackerrank | MySQL | Weather Observation Station 8 (0) | 2020.08.27 |
---|---|
Hackerrank | MySQL | Weather Observation Station 7 (0) | 2020.08.27 |
Hackerrank | MySQL | Weather Observation Station 5 (0) | 2020.08.27 |
Hackerrank | MySQL | Weather Observation Station 4 (0) | 2020.08.27 |
Hackerrank | MySQL | Weather Observation Station 3 (0) | 2020.08.27 |
Comments