- Weather Observation Station 9

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

Input Format

The STATION table is described as follows:

where LAT_N is the northern latitude and LONG_W is the western longitude.

MySql:

sol1:

select distinct city from station where left(city,1) not in ('a','e','i','o','u')

sol2:

SELECT DISTINCT CITY FROM STATION WHERE CITY REGEXP '^[^aeiou]';;

Oracle:

SELECT DISTINCT CITY
FROM STATION
WHERE NOT (CITY LIKE 'A%' OR  CITY  LIKE 'E%' OR CITY  LIKE 'I%' OR CITY  LIKE 'O%' OR CITY  LIKE 'U%');
Expected Output
  • Baileyville 
  • Bainbridge 
  • Baker 
  • Baldwin 
  • Barrigada 
  • Bass Harbor 
  • Baton Rouge 
  • Bayville 
  • Beaufort 
  • Beaver Island 
  • Bellevue 
  • Benedict 
  • Bennington 
  • Bentonville 
  • Berryton 
  • Bertha 
  • Beverly 
  • Biggsville 
  • Bison 
  • Blue River {-truncated-}

Post a Comment

Previous Post Next Post