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

Answer : select city from station where city like ‘[aeiou]%’
2 – Query the names of all American cities in CITY with populations larger than 120000. The CountryCode for America is USA.

Answer : select name from city where countrycode =’USA’ and population > 120000
3 – Query a list of CITY names from STATION with even ID numbers only. You may print the results in any order, but must exclude duplicates . 
Answer : select distinct city from station where id % 2=0 order by city
4 – Query the two cities in STATION with the shortest and longest CITY names, as well as their respective lengths (i.e.: number of characters in the name). If there is more than one smallest or largest city, choose the one that comes first when ordered alphabetically.
Input Format
The STATION table is described as follows:

Sample Output
ABC 3
PQRS 4
Answer : select top 1 city,LEN(city) from STATION order by len(city),city;
select top 1 city,LEN(city) from STATION order by len(city) desc
5 – Query the Name of any student in STUDENTS who scored higher than Marks. Order your output by the last three characters of each name. If two or more students both have names ending in the same last three characters (i.e.: Bobby, Robby, etc.), secondary sort them by ascending ID.

select name
from students
where marks>75 and name=’Stuart’
order by substring(name,len(name)-2, 3) , id asc;
Explanation of Substring : SELECT substring(‘W3Schools.com’,LEN(‘W3Schools.com’)-2,3); –> com (13-2) =11 ,3 –> 11 to 3
substring(‘W3Schools.com’,LEN(‘W3Schools.com’)-1,3); –> om (12-2) =10 ,3 –> 10 to 3
substring(‘W3Schools.com’,LEN(‘W3Schools.com’)-3,3); –> om (12-3) =9 ,3 –> 9 to 12
