230220
정규표현식 튜토리얼 https://regexone.com/lesson/introduction_abcs
정규표현식 테스트 https://regexr.com/
튜토리얼에 기본적인 문법은 나와있으니 참고해서 풀자!
https://www.hackerrank.com/challenges/weather-observation-station-6/problem?isFullScreen=true
Query the list of CITY names starting with vowels (i.e., a, e, i, o, or u) from STATION. Your result cannot contain duplicates.
SELECT DISTINCT city
FROM STATION
WHERE city REGEXP '^[aeiou].*'
https://www.hackerrank.com/challenges/weather-observation-station-7/problem?isFullScreen=true
Query the list of CITY names ending with vowels (a, e, i, o, u) from STATION. Your result cannot contain duplicates.
SELECT DISTINCT city
FROM station
WHERE city REGEXP '.*[aeiou]$'
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 city REGEXP '^[aeiou].*[aeiou]$'
9-11은 6-8번 반대, NOT만 붙이면 된다.
https://www.hackerrank.com/challenges/weather-observation-station-9/problem?isFullScreen=true
Query the list of CITY names from STATION that do not start with vowels. Your result cannot contain duplicates.
SELECT DISTINCT city
FROM station
WHERE city REGEXP '^[^aeiou].*'
SELECT DISTINCT city
FROM station
WHERE city NOT REGEXP '^[aeiou].*'
앞에 NOT 붙이는 것도 가능
https://www.hackerrank.com/challenges/weather-observation-station-10/problem?isFullScreen=true
Query the list of CITY names from STATION that do not end with vowels. Your result cannot contain duplicates.
SELECT DISTINCT city
FROM station
WHERE city NOT REGEXP '.*[aeiou]$'
https://www.hackerrank.com/challenges/weather-observation-station-11/problem?isFullScreen=true
Query the list of CITY names from STATION that either do not start with vowels or do not end with vowels. Your result cannot contain duplicates.
SELECT DISTINCT city
FROM station
WHERE city NOT REGEXP '^[aeiou].*[aeiou]$'