일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 패캠챌린지
- medium
- 해커랭크
- 패스트캠퍼스후기
- 직장인자기계발
- HACKER_RANK
- SELF-JOIN
- LeetCode
- 파이썬을활용한시계열데이터분석
- 프리미엄
- 프로그래머스
- 직장인인강
- easy
- lv.4
- meidum
- row_number
- group by
- 다시풀어보기
- RANK
- recursive
- solvesql
- 파이썬을활용한시계열데이터분석AtoZ올인원패키지Online
- 어려웠음
- 패스트캠퍼스
- Hackerrank
- join
- Hard
- MySQL
- SQL
- 시계열데이터분석
- Today
- Total
~고군분투 인생살이~
[EASY] Weather Observation Station 6 본문
1. 문제 설명
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:

where LAT_N is the northern latitude and LONG_W is the western longitude.
2. 문제 풀이
이번에는 기존 like와 더불어 정규 표현식으로 해당 문제를 풀어보려고 합니다.
정규표현식에 대한 더 자세한 설명은 아래의 사이트를 참고하자.
RegexOne - Learn Regular Expressions - Lesson 1: An Introduction, and the ABCs
Regular expressions are extremely useful in extracting information from text such as code, log files, spreadsheets, or even documents. And while there is a lot of theory behind formal languages, the following lessons and examples will explore the more prac
regexone.com
RegExr: Learn, Build, & Test RegEx
RegExr is an online tool to learn, build, & test Regular Expressions (RegEx / RegExp).
regexr.com
3. 결과
기존 like 방식
SELECT city
FROM STATION
WHERE state like 'a%'
OR state like 'e%'
OR state like 'i%'
OR state like 'o%'
OR state like 'u%'
정규 표현식
select distinct city
from station
where city regexp '^[AEIOUaeiou].*' --SQL은 대소문자에 까다롭지 않기 때문에 소문자만 기입해도 된다.
'SQL > HACKER_RANK' 카테고리의 다른 글
[HACKER_RANK] THE-PADS (0) | 2022.06.13 |
---|---|
[EASY] Weather Observation Station 9 (0) | 2022.05.29 |
[EASY] Weather Observation Station 8 (0) | 2022.05.29 |
[EASY] Weather Observation Station 7 (0) | 2022.05.29 |
[HACKER_RANK] THE REPORT (0) | 2022.05.01 |