Anusha Murali

Logo

Please see github.com/anusha-murali for all of my repositories.

View GitHub Profile

22. Weather Observation Station 7: Solution


Query the list of CITY names ending with vowels (a, e, i, o, u) from STATION. Your result cannot contain duplicates.

The STATION table is described as follows:

16

where LAT_N is the northern latitude and LONG_W is the western longitude.

solution_image5

We can use the SUBSTR() function to check if the last letter of the city is a vowel as follows:

SELECT DISTINCT CITY
FROM STATION
WHERE SUBSTR(CITY, LENGTH(CITY), 1) IN ('a', 'e', 'i', 'o', 'u');

We can also use the REGEXP_LIKE() function to check if the last letter of the city is a vowel as follows:

SELECT DISTINCT CITY
FROM STATION
WHERE REGEXP_LIKE(CITY, '*[aeiou]$');

Back to problems


anusha-murali.github.io