# Weather Observation Station 8

Query the list of *CITY* names from **STATION** which have vowels (i.e., *a*, *e*, *i*, *o*, and *u*) as both their first *and* last characters. Your result cannot contain duplicates.

{% embed url="<https://www.hackerrank.com/challenges/weather-observation-station-8/problem?isFullScreen=true>" %}

Sol:

<mark style="color:blue;">`SELECT DISTINCT CITY FROM STATION`</mark>&#x20;

<mark style="color:blue;">`WHERE CITY REGEXP '^[AEIOU]' AND CITY REGEXP '[AEIOU]$';`</mark>

Explanation:

* REGEXP '^\[AEIOU]': This condition in the WHERE clause checks if the CITY column starts with any of the specified vowels using the regular expression pattern ^\[AEIOU].
  * ^ denotes the start of the string.
  * \[AEIOU] denotes a character class that matches any one character from the specified set of vowels ('A', 'E', 'I', 'O', 'U').
* 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 city name both starts and ends with one of the specified vowels.
