[HackerRank/SQL] Basic Select - Weather Observation Station 12
Problem. Basic Select - Weather Observation Station 12
Link.
https://www.hackerrank.com/challenges/weather-observation-station-12/problem?isFullScreen=true
Weather Observation Station 12 | HackerRank
Query an alphabetically ordered list of CITY names not starting and ending with vowels.
www.hackerrank.com
Description.
Query the list of CITY names from STATION that do not start with vowels and do not end with vowels.
Your result cannot contain duplicates.
Key Point.
REGXP, 정규표현식(Regular Expression)을 사용하면 복잡한 문자열 조건을 걸어 데이터를 검색할 수 있다.
My Answer.
SELECT DISTINCT CITY
FROM STATION
WHERE CITY REGEXP '^[^aeiou].*[^aeiou]$';
References.
MySQL 정규표현식: https://velog.io/@gillog/MySQL-REGEXPRegular-Expression%EC%A0%95%EA%B7%9C-%ED%91%9C%ED%98%84%EC%8B%9D
[MySQL] REGEXP(Regular Expression(정규 표현식))
REGEXP는 LIKE를 이용한 검색과 달리 Regular Expression(정규 표현식)를 이용해 검색한다.REGEXP를 사용하면 SQL에서 정규표현식을 활용하여 기본 연산자보다 복잡한 문자열 조건을 걸어 데이터를 검색할
velog.io