> For the complete documentation index, see [llms.txt](https://pavithrasundaram091097s-organiza.gitbook.io/my-space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pavithrasundaram091097s-organiza.gitbook.io/my-space/skills/hackerrank/weather-observation-station-11.md).

# Weather Observation Station 11

Query the list of *CITY* names from **STATION** that either do not start with vowels or do not end with vowels. Your result cannot contain duplicates.

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

Sol:

select distinct city from station where not city regexp '^\[aeoiu].\*\[aeiou]$'

Explanation:\
This query retrieves distinct city names from the STATION table where the city name does not start with a vowel ('a', 'e', 'o', 'i', or 'u') and does not end with a vowel.

* NOT CITY REGEXP '^\[aeoiu].\*\[aeiou]$': This condition in the WHERE clause checks if the CITY column does not match the pattern defined by the regular expression.
  * ^\[aeoiu]: This part of the regular expression matches city names that start with any of the vowels 'a', 'e', 'o', 'i', or 'u'.
  * .\*: This part of the regular expression matches any sequence of characters (zero or more) between the first and last character of the city name.
  * \[aeiou]$: This part of the regular expression matches city names that end with any of the vowels 'a', 'e', 'o', 'i', or 'u'.
  * NOT: This negates the condition, selecting city names that do not match the defined pattern.

So, the query selects cities where the city name neither starts nor ends with a vowel.
