SQL Saturday

SQL Saturday

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

SELECT DISTINCT CITY

FROM STATION

WHERE City like “A%” or City like “E%” or City like “I%” or City like “O%” or City like”U%”;

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

SELECT DISTINCT CITY
FROM STATION
WHERE City like "%a" or City like "%e" or City like "%i" or City like "%o" or City like"%u";

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

SELECT DISTINCT CITY
FROM STATION
WHERE City like "A%" AND (City like "%a" or City like "%e" or City like "%i" or City like "%o" or City like"%u") or
      City like "E%" AND (City like "%a" or City like "%e" or City like "%i" or City like "%o" or City like"%u") or 
      City like "I%" AND (City like "%a" or City like "%e" or City like "%i" or City like "%o" or City like"%u") or 
      City like "O%" AND (City like "%a" or City like "%e" or City like "%i" or City like "%o" or City like"%u") or 
      City like"U%" AND (City like "%a" or City like "%e" or City like "%i" or City like "%o" or City like"%u");

Query the list of CITY names from STATION that does not start with vowels. Your result cannot contain duplicates.

SELECT DISTINCT CITY
FROM STATION
WHERE City NOT like "A%" AND City NOT like "E%" AND City NOT like "I%" AND City NOT like "O%" AND City NOT like"U%";

Query the list of CITY names from STATION that does not end with vowels. Your result cannot contain duplicates.

SELECT DISTINCT CITY
FROM STATION
WHERE City NOT like "%a" AND City NOT like "%e" AND City NOT like "%i" AND City NOT like "%o" AND City NOT like"%u";