[Problem]
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.
[My Answer]
- first wrong answer,,,
1
2
|
SELECT city FROM station
WHERE city LIKE 'a%'
|
cs |
- Right answer
1
2
|
SELECT DISTINCT CITY
FROM STATION WHERE CITY REGEXP '^[aeiou]'
|
cs |
Did you see that my stupid first query... I was trying to UNION ALL queries with 'a, e, i, o, u' with LIKE query... Don't forget the REGEXP query...
* REGEXP is the operator used when performing regular expression pattern matches.
It is not just basic query practice, it is surprisingly tough for me, which means I am still an amateur and there are so many things to learn to be mature.
'Code Problems > SQL_ HackerRank' 카테고리의 다른 글
[HackerRank] Weather Observation Station 8 (0) | 2021.04.30 |
---|---|
[HackerRank] Weather Observation Station 7 (0) | 2021.04.18 |
[Hacker Rank] Weather Observation Station 5 (0) | 2021.04.17 |
[HackerRank] Weather Observation Station 4 (0) | 2021.04.11 |
[HackerRank] Weather Observation Station 3 (0) | 2021.04.08 |