Given a table STATION that holds data for five fields namely ID, CITY, STATE, NORTHERN LATITUDE and WESTERN LONGITUDE.
1) Write a query to print the list of CITY that start with vowels (a, e, i, o, u) in lexicographical order. Do not print 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%' order by city;
2) Write a query to print the list of CITY that ends with vowels (a, e, i, o, u) in lexicographical order. Do not print 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' order by city;
+-------------+------------+| Field | Type |+-------------+------------+| ID | INTEGER || CITY | VARCHAR(21)|| STATE | VARCHAR(2) || LAT_N | NUMERIC || LONG_W | NUMERIC |+-------------+------------+>>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%' order by city;
2) Write a query to print the list of CITY that ends with vowels (a, e, i, o, u) in lexicographical order. Do not print 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' order by city;
No comments:
Post a Comment