Weather Observation Station 6
Query the list of CITY names starting with vowels (i.e., a
, e
, i
, o
, or 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 starts with any of the vowels 'A', 'E', 'I', 'O', or 'U' using the regular expression pattern ^[AEIOU]. The ^ denotes the start of the string, and [AEIOU] matches any one character from the specified set of vowels. Note: The REGEXP operator is used in SQL to perform pattern matching using regular expressions. Regular expressions are patterns used to match character combinations in strings.
Last updated