Friday 31 March 2017

Weather Observation Station 6

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.

Input Format

The STATION table is described as follows:


where LAT_N is the northern latitude and LONG_W is the western longitude.
Query  for:
Mysql:
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%';

or
 select distinct city 
from station
where city like '[aeiou]%';

MS SQL Server:select distinct city
from station 
where left(city,1) in('a','e','i','o','u') ;


3 comments:

  1. i try the 3 types and i still got an error
    https://gyazo.com/86af6193269f2c830efa76ae019f381b

    ReplyDelete
  2. The code works fine. It seems you have written the code in a comment hence not working. Write the code after /*..*/ this is over. Hope this clears your doubt.

    ReplyDelete
  3. select distinct city
    from station
    where city like '[aeiou]%'; this is not working, i dont know why

    ReplyDelete