Weather Observation Station 7

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

Sol:

SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP '[AEIOU]$';

Explanation:

  • REGEXP '[AEIOU]$': This condition in the WHERE clause checks if the CITY column ends with any of the specified vowels using the regular expression pattern [AEIOU]$.

    • [AEIOU] denotes a character class that matches any one character from the specified set of vowels ('A', 'E', 'I', 'O', 'U').

    • $ denotes the end of the string.

So, the query selects cities where the last character of the city name is one of the specified vowels.

Last updated