Database: flight_2
# airlines ( uid , airline , abbreviation , country )
# airports ( city , airportcode , airportname , country , countryabbrev )
# flights ( airline , flightno , sourceairport , destairport )
# flights.destairport = airports.airportcode
# flights.sourceairport = airports.airportcode

Question: Which country does Airline "JetBlue Airways" belong to?
SQL: select country from airlines where airline = 'JetBlue Airways'

Question: What country is Jetblue Airways affiliated with?
SQL: select country from airlines where airline = 'JetBlue Airways'

Question: What is the abbreviation of Airline "JetBlue Airways"?
SQL: select abbreviation from airlines where airline = 'JetBlue Airways'

Question: Which abbreviation corresponds to Jetblue Airways?
SQL: select abbreviation from airlines where airline = 'JetBlue Airways'

Question: List all airline names and their abbreviations in "USA".
SQL: select airline , abbreviation from airlines where country = 'USA'

Question: What are the airline names and abbreviations for airlines in the USA?
SQL: select airline , abbreviation from airlines where country = 'USA'

Question: List the airport code and name in the city of Anthony.
SQL: select airportcode , airportname from airports where city = 'Anthony'

Question: Give the airport code and airport name corresonding to the city Anthony.
SQL: select airportcode , airportname from airports where city = 'Anthony'

Question: How many airlines do we have?
SQL: select count ( * ) from airlines

Question: What is the total number of airlines?
SQL: select count ( * ) from airlines

Question: How many airports do we have?
SQL: select count ( * ) from airports

Question: Return the number of  airports.
SQL: select count ( * ) from airports

Question: How many flights do we have?
SQL: select count ( * ) from flights

Question: Return the number of flights.
SQL: select count ( * ) from flights

Question: Which airline has abbreviation 'UAL'?
SQL: select airline from airlines where abbreviation = 'UAL'

Question: Give the airline with abbreviation 'UAL'.
SQL: select airline from airlines where abbreviation = 'UAL'

Question: How many airlines are from USA?
SQL: select count ( * ) from airlines where country = 'USA'

Question: Return the number of airlines in the USA.
SQL: select count ( * ) from airlines where country = 'USA'

Question: Which city and country is the Alton airport at?
SQL: select city , country from airports where airportname = 'Alton'

Question: Give the city and country for the Alton airport.
SQL: select city , country from airports where airportname = 'Alton'

Question: What is the airport name for airport 'AKO'?
SQL: select airportname from airports where airportcode = 'AKO'

Question: Return the name of the airport with code 'AKO'.
SQL: select airportname from airports where airportcode = 'AKO'

Question: What are airport names at City 'Aberdeen'?
SQL: select airportname from airports where city = 'Aberdeen'

Question: What are the names of airports in Aberdeen?
SQL: select airportname from airports where city = 'Aberdeen'

Question: How many flights depart from 'APG'?
SQL: select count ( * ) from flights where sourceairport = 'APG'

Question: Count the number of flights departing from 'APG'.
SQL: select count ( * ) from flights where sourceairport = 'APG'

Question: How many flights have destination ATO?
SQL: select count ( * ) from flights where destairport = 'ATO'

Question: Count the number of flights into ATO.
SQL: select count ( * ) from flights where destairport = 'ATO'

Question: How many flights depart from City Aberdeen?
SQL: select count ( * ) from flights join airports on flights.sourceairport = airports.airportcode where airports.city = 'Aberdeen'

Question: Return the number of flights departing from Aberdeen.
SQL: select count ( * ) from flights join airports on flights.sourceairport = airports.airportcode where airports.city = 'Aberdeen'

Question: How many flights arriving in Aberdeen city?
SQL: select count ( * ) from flights join airports on flights.destairport = airports.airportcode where airports.city = 'Aberdeen'

Question: Return the number of flights arriving in Aberdeen.
SQL: select count ( * ) from flights join airports on flights.destairport = airports.airportcode where airports.city = 'Aberdeen'

Question: How many flights depart from City 'Aberdeen' and have destination City 'Ashley'?
SQL: select count ( * ) from flights join airports on flights.destairport = airports.airportcode join airports on flights.sourceairport = airports.airportcode where airports.city = 'Ashley' and airports.city = 'Aberdeen'

Question: How many flights fly from Aberdeen to Ashley?
SQL: select count ( * ) from flights join airports on flights.destairport = airports.airportcode join airports on flights.sourceairport = airports.airportcode where airports.city = 'Ashley' and airports.city = 'Aberdeen'

Question: How many flights does airline 'JetBlue Airways' have?
SQL: select count ( * ) from flights join airlines on flights.airline = airlines.uid where airlines.airline = 'JetBlue Airways'

Question: Give the number of Jetblue Airways flights.
SQL: select count ( * ) from flights join airlines on flights.airline = airlines.uid where airlines.airline = 'JetBlue Airways'

Question: How many 'United Airlines' flights go to Airport 'ASY'?
SQL: select count ( * ) from airlines join flights on flights.airline = airlines.uid where airlines.airline = 'United Airlines' and flights.destairport = 'ASY'

Question: Count the number of United Airlines flights arriving in ASY Airport.
SQL: select count ( * ) from airlines join flights on flights.airline = airlines.uid where airlines.airline = 'United Airlines' and flights.destairport = 'ASY'

Question: How many 'United Airlines' flights depart from Airport 'AHD'?
SQL: select count ( * ) from airlines join flights on flights.airline = airlines.uid where airlines.airline = 'United Airlines' and flights.sourceairport = 'AHD'

Question: Return the number of United Airlines flights leaving from AHD Airport.
SQL: select count ( * ) from airlines join flights on flights.airline = airlines.uid where airlines.airline = 'United Airlines' and flights.sourceairport = 'AHD'

Question: How many United Airlines flights go to City 'Aberdeen'?
SQL: select count ( * ) from flights join airports on flights.destairport = airports.airportcode join airlines on airlines.uid = flights.airline where airports.city = 'Aberdeen' and airlines.airline = 'United Airlines'

Question: Count the number of United Airlines flights that arrive in Aberdeen.
SQL: select count ( * ) from flights join airports on flights.destairport = airports.airportcode join airlines on airlines.uid = flights.airline where airports.city = 'Aberdeen' and airlines.airline = 'United Airlines'

Question: Which city has most number of arriving flights?
SQL: select airports.city from airports join flights on airports.airportcode = flights.destairport group by airports.city order by count ( * ) desc limit 1

Question: Which city has the most frequent destination airport?
SQL: select airports.city from airports join flights on airports.airportcode = flights.destairport group by airports.city order by count ( * ) desc limit 1

Question: Which city has most number of departing flights?
SQL: select airports.city from airports join flights on airports.airportcode = flights.sourceairport group by airports.city order by count ( * ) desc limit 1

Question: Which city is the most frequent source airport?
SQL: select airports.city from airports join flights on airports.airportcode = flights.sourceairport group by airports.city order by count ( * ) desc limit 1

Question: What is the code of airport that has the highest number of flights?
SQL: select airports.airportcode from airports join flights on airports.airportcode = flights.destairport or airports.airportcode = flights.sourceairport group by airports.airportcode order by count ( * ) desc limit 1

Question: What is the airport code of the airport with the most flights?
SQL: select airports.airportcode from airports join flights on airports.airportcode = flights.destairport or airports.airportcode = flights.sourceairport group by airports.airportcode order by count ( * ) desc limit 1

Question: What is the code of airport that has fewest number of flights?
SQL: select airports.airportcode from airports join flights on airports.airportcode = flights.destairport or airports.airportcode = flights.sourceairport group by airports.airportcode order by count ( * ) asc limit 1

Question: Give the code of the airport with the least flights.
SQL: select airports.airportcode from airports join flights on airports.airportcode = flights.destairport or airports.airportcode = flights.sourceairport group by airports.airportcode order by count ( * ) asc limit 1

Question: Which airline has most number of flights?
SQL: select airlines.airline from airlines join flights on airlines.uid = flights.airline group by airlines.airline order by count ( * ) desc limit 1

Question: What airline serves the most flights?
SQL: select airlines.airline from airlines join flights on airlines.uid = flights.airline group by airlines.airline order by count ( * ) desc limit 1

Question: Find the abbreviation and country of the airline that has fewest number of flights?
SQL: select airlines.abbreviation , airlines.country from airlines join flights on airlines.uid = flights.airline group by airlines.airline order by count ( * ) asc limit 1

Question: What is the abbreviation of the airilne has the fewest flights and what country is it in?
SQL: select airlines.abbreviation , airlines.country from airlines join flights on airlines.uid = flights.airline group by airlines.airline order by count ( * ) asc limit 1

Question: What are airlines that have some flight departing from airport 'AHD'?
SQL: select airlines.airline from airlines join flights on airlines.uid = flights.airline where flights.sourceairport = 'AHD'

Question: Which airlines have a flight with source airport AHD?
SQL: select airlines.airline from airlines join flights on airlines.uid = flights.airline where flights.sourceairport = 'AHD'

Question: What are airlines that have flights arriving at airport 'AHD'?
SQL: select airlines.airline from airlines join flights on airlines.uid = flights.airline where flights.destairport = 'AHD'

Question: Which airlines have a flight with destination airport AHD?
SQL: select airlines.airline from airlines join flights on airlines.uid = flights.airline where flights.destairport = 'AHD'

Question: Find all airlines that have flights from both airports 'APG' and 'CVO'.
SQL: select airlines.airline from airlines join flights on airlines.uid = flights.airline where flights.sourceairport = 'APG' intersect select airlines.airline from airlines join flights on airlines.uid = flights.airline where flights.sourceairport = 'CVO'

Question: Which airlines have departing flights from both APG and CVO airports?
SQL: select airlines.airline from airlines join flights on airlines.uid = flights.airline where flights.sourceairport = 'APG' intersect select airlines.airline from airlines join flights on airlines.uid = flights.airline where flights.sourceairport = 'CVO'

Question: Find all airlines that have flights from airport 'CVO' but not from 'APG'.
SQL: select airlines.airline from airlines join flights on airlines.uid = flights.airline where flights.sourceairport = 'CVO' except select airlines.airline from airlines join flights on airlines.uid = flights.airline where flights.sourceairport = 'APG'

Question: Which airlines have departures from CVO but not from APG airports?
SQL: select airlines.airline from airlines join flights on airlines.uid = flights.airline where flights.sourceairport = 'CVO' except select airlines.airline from airlines join flights on airlines.uid = flights.airline where flights.sourceairport = 'APG'

Question: Find all airlines that have at least 10 flights.
SQL: select airlines.airline from airlines join flights on airlines.uid = flights.airline group by airlines.airline having count ( * ) > 10

Question: Which airlines have at least 10 flights?
SQL: select airlines.airline from airlines join flights on airlines.uid = flights.airline group by airlines.airline having count ( * ) > 10

Question: Find all airlines that have fewer than 200 flights.
SQL: select airlines.airline from airlines join flights on airlines.uid = flights.airline group by airlines.airline having count ( * ) < 200

Question: Which airlines have less than 200 flights?
SQL: select airlines.airline from airlines join flights on airlines.uid = flights.airline group by airlines.airline having count ( * ) < 200

Question: What are flight numbers of Airline "United Airlines"?
SQL: select flights.flightno from flights join airlines on airlines.uid = flights.airline where airlines.airline = 'United Airlines'

Question: Which flight numbers correspond to United Airlines flights?
SQL: select flights.flightno from flights join airlines on airlines.uid = flights.airline where airlines.airline = 'United Airlines'

Question: What are flight numbers of flights departing from Airport "APG"?
SQL: select flightno from flights where sourceairport = 'APG'

Question: Give the flight numbers of flights leaving from APG.
SQL: select flightno from flights where sourceairport = 'APG'

Question: What are flight numbers of flights arriving at Airport "APG"?
SQL: select flightno from flights where destairport = 'APG'

Question: Give the flight numbers of flights landing at APG.
SQL: select flightno from flights where destairport = 'APG'

Question: What are flight numbers of flights departing from City "Aberdeen "?
SQL: select flights.flightno from flights join airports on flights.sourceairport = airports.airportcode where airports.city = 'Aberdeen'

Question: Give the flight numbers of flights leaving from Aberdeen.
SQL: select flights.flightno from flights join airports on flights.sourceairport = airports.airportcode where airports.city = 'Aberdeen'

Question: What are flight numbers of flights arriving at City "Aberdeen"?
SQL: select flights.flightno from flights join airports on flights.destairport = airports.airportcode where airports.city = 'Aberdeen'

Question: Give the flight numbers of flights arriving in Aberdeen.
SQL: select flights.flightno from flights join airports on flights.destairport = airports.airportcode where airports.city = 'Aberdeen'

Question: Find the number of flights landing in the city of Aberdeen or Abilene.
SQL: select count ( * ) from flights join airports on flights.destairport = airports.airportcode where airports.city = 'Aberdeen' or airports.city = 'Abilene'

Question: How many flights land in Aberdeen or Abilene?
SQL: select count ( * ) from flights join airports on flights.destairport = airports.airportcode where airports.city = 'Aberdeen' or airports.city = 'Abilene'

Question: Find the name of airports which do not have any flight in and out.
SQL: select airportname from airports where airportcode not in ( select sourceairport from flights union select destairport from flights )

Question: Which airports do not have departing or arriving flights?
SQL: select airportname from airports where airportcode not in ( select sourceairport from flights union select destairport from flights )