새소식

IT/SQL

[해커랭크] Weather Observation Station 10

  • -
728x90
반응형

문제링크 : 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.

(모음으로 끝나지 않는 도시 이름, 중복 포함X)

Input Format

The STATION table is described as follows:

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

 

SELECT DISTINCT CITY
FROM STATION
WHERE CITY REGEXP '[^aeiou]$'

 


SQLD 시험이 끝나서 이번 문제부터는 MySQL로 풀 예정입니다.

 

REGEXP

  • 정규표현식

[^aeiou]$

  • [] : 괄호 안의 문자열 일치를 확인한다.
  • ^ : 문자열의 처음을 나타낸다.
  • ⭐[^aeiou] : (부정의 의미)  'a' 또는 'e' 또는 'i' 또는 'o' 또는 'u'를 포함하는 문자열 제외 
  • $ : 문자열의 끝을 나타낸다.

 

즉, 모음으로 끝나는 문자열을 제외하는 정규식

728x90
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.