[hackerrank] Prepare > SQL > Basic Select > Weather Observation Station 6
[문제]
Query the list of CITY names starting with vowels (i.e., a, e, i, o, or u) from STATION. 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.
[MYSQL]
[ORCALE]
-- 1차
-- select city
-- from station
-- where substr(city,0,1) = 'A'
-- or substr(city,0,1) = 'E'
-- or substr(city,0,1) = 'I'
-- or substr(city,0,1) = 'O'
-- or substr(city,0,1) = 'U';
-- 2차
-- select city
-- from station
-- where city like 'A%'
-- or city like 'E%'
-- or city like 'I%'
-- or city like 'O%'
-- or city like 'U%';
--3차
-- select city
-- from station
-- where regexp_like(city,'^A|^E|^I|^O|^U');
--4차
select city
from station
where regexp_like(city,'^a|^e|^i|^o|^u','i');
반응형
'HackerRank > SQL' 카테고리의 다른 글
[hackerrank] Weather Observation Station 8 (0) | 2022.08.08 |
---|---|
[hackerrank] Weather Observation Station 7 (0) | 2022.08.08 |
[hackerrank] Weather Observation Station 5 (0) | 2022.08.08 |
[hackerrank] Weather Observation Station 4 (0) | 2022.08.08 |
[hackerrank] Weather Observation Station 3 (0) | 2022.08.08 |