본문 바로가기
서버/MYSQL

[MYSQL] HACKERRANK - Weather Observation Station 12

by HDobby 2022. 12. 14.

https://www.hackerrank.com/challenges/weather-observation-station-12/problem

 

Weather Observation Station 12 | HackerRank

Query an alphabetically ordered list of CITY names not starting and ending with vowels.

www.hackerrank.com

문제

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.

Input Format

The STATION table is described as follows:

where LAT_N is the northern latitude and LONG_W is the western longitude.

 

생각해보기

REGEXP를 이용하여 AND로 2가지 조건을 준다.

 

코드

더보기
select distinct(city)
from station
where city not regexp('[aeiou]$') and city not regexp('^[aeiou]');
728x90

댓글