본문 바로가기
SQL

[HackerRank SQL] Weather Observation Station 7 (Oracle)

by 동글엘라 2024. 3. 31.

Weather Observation Station 7

 

Problem

 

Query the list of CITY names ending with vowels (a, e, i, o, u) from STATION. Your result cannot contain duplicates.

(STATION에서 모음(a, e, i, o, u)으로 끝나는 도시(CITY) 이름의 목록을 조회하라. 결과에는 중복이 포함되어서는 안 됨.)

Input Format

The STATION table is described as follows:

Solution(Oracle)

 

SELECT DISTINCT CITY
    FROM STATION
   WHERE CITY LIKE '%a'
      OR CITY LIKE '%e'
      OR CITY LIKE '%i'
      OR CITY LIKE '%o'
      OR CITY LIKE '%u';
      
-- 대소문자 구분없이 사용하고 싶을때
SELECT DISTINCT CITY
	FROM STATION
   WHERE UPPER(CITY) LIKE '%A'
      OR UPPER(CITY) LIKE '%E'
      OR UPPER(CITY) LIKE '%I'
      OR UPPER(CITY) LIKE '%O'
      OR UPPER(CITY) LIKE '%U';

 

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

 

Weather Observation Station 7 | HackerRank

Query the list of CITY names ending with vowels (a, e, i, o, u) from STATION.

www.hackerrank.com