나홀로공부/Oracle

HackerRank - Weather Observation Station 8

mikan- 2023. 5. 6. 23:53

 

Question - HackerRank - Weather Observation Station 8

 

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.
Input Format
The STATION table is described as follows:

 

해석

 

STATION에서 첫 문자와 마지막 문자로 모음(예: a, e, i, o 및 u)이 있는 CITY 이름 목록을 쿼리합니다. 결과에 중복 항목을 포함할 수 없습니다.

 

정답

 

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%')
    AND(
    city LIKE '%a'
    OR city LIKE '%e'
    OR city LIKE '%i'
    OR city LIKE '%o'
    OR city LIKE '%u');