cs

[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:

https://www.hackerrank.com/challenges/weather-observation-station-6/problem?h_r=next-challenge&h_v=zen

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. 

 

+ Recent posts