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.
- query CITY names ==> SELECT CITY
- from STATION table ==> FROM STATION
- do not start and end with vowels ==> WHERE CITY REGEXP ‘^[^aeiou].*[^aeiou]$’
- do not contain duplicates ==> SELECT DISTINCT CITY
select distinct city
from station
where (left(city,1) not in ('a','e','i','o','u')
and
right(city,1) not in ('a','e','i','o','u'));
SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP '^[^aeiou].*[^aeiou]$';
SELECT * FROM TEST WHERE regexp_like(text, '[a-z][0-9]');
[a-z], [0-9]는 소문자 전체와 0부터9까지의 숫자를 나타냅니다.
'Algorithm > SQL' 카테고리의 다른 글
[SQL][HackerRank] Employee Names (0) | 2020.06.09 |
---|---|
[SQL][HackerRank] Higher Than 75 Marks (0) | 2020.06.09 |
[SQL][HackerRank] Weather Observation Station 11 (0) | 2020.06.09 |
[SQL][HackerRank] Weather Observation Station 10 (0) | 2020.06.09 |
[SQL][HackerRank] Weather Observation Station 9 (0) | 2020.06.09 |