[Schema (values) (types)]: | flight_4 |  routes : rid (text) , dst_apid (number) , dst_ap (number) , src_apid (text) , src_ap (number) , alid (text) , airline (number) , codeshare (text) | airports : apid (text) , name (number) , city (number) , country (text) , x (number) , y (text) , elevation (number) , iata (text) , icao (text) | airlines : alid (text) , name (number) , iata (number) , icao (text) , callsign (number) , country (text) , active (number);
[Primary Keys]: routes : rid, airports : apid, airlines : alid
[Foreign Keys]: routes : alid = airlines : alid | routes : src_apid = airports : apid | routes : dst_apid = airports : apid

Question: Find the name of the airport in the city of Goroka.
SQL: SELECT name FROM airports WHERE city  =  'Goroka'

Question: What are the names of the airports in the city of Goroka?
SQL: SELECT name FROM airports WHERE city  =  'Goroka'

Question: Find the name, city, country, and altitude (or elevation) of the airports in the city of New York.
SQL: SELECT name ,  city ,  country ,  elevation FROM airports WHERE city  =  'New York'

Question: What is the name, city, country, and elevation for every airport in the city of New York?
SQL: SELECT name ,  city ,  country ,  elevation FROM airports WHERE city  =  'New York'

Question: How many airlines are there?
SQL: SELECT count(*) FROM airlines

Question: What is the total number of airlines?
SQL: SELECT count(*) FROM airlines

Question: How many airlines does Russia has?
SQL: SELECT count(*) FROM airlines WHERE country  =  'Russia'

Question: What is the number of airlines based in Russia?
SQL: SELECT count(*) FROM airlines WHERE country  =  'Russia'

Question: What is the maximum elevation of all airports in the country of Iceland?
SQL: SELECT max(elevation) FROM airports WHERE country  =  'Iceland'

Question: What is the highest elevation of an airport in the country of Iceland?
SQL: SELECT max(elevation) FROM airports WHERE country  =  'Iceland'

Question: Find the name of the airports located in Cuba or Argentina.
SQL: SELECT name FROM airports WHERE country  =  'Cuba' OR country  =  'Argentina'

Question: What are the names of all airports in Cuba or Argentina?
SQL: SELECT name FROM airports WHERE country  =  'Cuba' OR country  =  'Argentina'

Question: Find the country of the airlines whose name starts with 'Orbit'.
SQL: SELECT country FROM airlines WHERE name LIKE 'Orbit%'

Question: What are the countries of all airlines whose names start with Orbit?
SQL: SELECT country FROM airlines WHERE name LIKE 'Orbit%'

Question: Find the name of airports whose altitude is between -50 and 50.
SQL: SELECT name FROM airports WHERE elevation BETWEEN -50 AND 50

Question: What are the names of all airports whose elevation is between -50 and 50?
SQL: SELECT name FROM airports WHERE elevation BETWEEN -50 AND 50

Question: Which country is the airport that has the highest altitude located in?
SQL: SELECT country FROM airports ORDER BY elevation DESC LIMIT 1

Question: What is the country of the airport with the highest elevation?
SQL: SELECT country FROM airports ORDER BY elevation DESC LIMIT 1

Question: Find the number of airports whose name contain the word 'International'.
SQL: SELECT count(*) FROM airports WHERE name LIKE '%International%'

Question: How many airports' names have the word Interanation in them?
SQL: SELECT count(*) FROM airports WHERE name LIKE '%International%'

Question: How many different cities do have some airport in the country of Greenland?
SQL: SELECT count(DISTINCT city) FROM airports WHERE country  =  'Greenland'

Question: In how many cities are there airports in the country of Greenland?
SQL: SELECT count(DISTINCT city) FROM airports WHERE country  =  'Greenland'

Question: Find the number of routes operated by American Airlines.
SQL: SELECT count(*) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid WHERE T1.name  =  'American Airlines'

Question: How many routes does American Airlines operate?
SQL: SELECT count(*) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid WHERE T1.name  =  'American Airlines'

Question: Find the number of routes whose destination airports are in Canada.
SQL: SELECT count(*) FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.dst_apid WHERE country  =  'Canada'

Question: How many routes end in a Canadian airport?
SQL: SELECT count(*) FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.dst_apid WHERE country  =  'Canada'

Question: Find the name, city, and country of the airport that has the lowest altitude.
SQL: SELECT name ,  city ,  country FROM airports ORDER BY elevation LIMIT 1

Question: What is the name, city, and country of the airport with the lowest altitude?
SQL: SELECT name ,  city ,  country FROM airports ORDER BY elevation LIMIT 1

Question: Find the name, city, and country of the airport that has the highest latitude.
SQL: SELECT name ,  city ,  country FROM airports ORDER BY elevation DESC LIMIT 1

Question: What is the name, city, and country of the airport with the highest elevation?
SQL: SELECT name ,  city ,  country FROM airports ORDER BY elevation DESC LIMIT 1

Question: Find the name and city of the airport which is the destination of the most number of routes.
SQL: SELECT T1.name ,  T1.city ,  T2.dst_apid FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.dst_apid GROUP BY T2.dst_apid ORDER BY count(*) DESC LIMIT 1

Question: What is the name and city of the airport that the most routes end at?
SQL: SELECT T1.name ,  T1.city ,  T2.dst_apid FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.dst_apid GROUP BY T2.dst_apid ORDER BY count(*) DESC LIMIT 1

Question: Find the names of the top 10 airlines that operate the most number of routes.
SQL: SELECT T1.name ,  T2.alid FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid GROUP BY T2.alid ORDER BY count(*) DESC LIMIT 10

Question: For the airline ids with the top 10 most routes operated, what are their names?
SQL: SELECT T1.name ,  T2.alid FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid GROUP BY T2.alid ORDER BY count(*) DESC LIMIT 10

Question: Find the name and city of the airport which is the source for the most number of flight routes.
SQL: SELECT T1.name ,  T1.city ,  T2.src_apid FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.src_apid GROUP BY T2.src_apid ORDER BY count(*) DESC LIMIT 1

Question: What is the name and city of the airport from most of the routes start?
SQL: SELECT T1.name ,  T1.city ,  T2.src_apid FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.src_apid GROUP BY T2.src_apid ORDER BY count(*) DESC LIMIT 1

Question: Find the number of different airports which are the destinations of the American Airlines.
SQL: SELECT count(DISTINCT dst_apid) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid WHERE T1.name  =  'American Airlines'

Question: What is the number of different different airports that are destinations for American Airlines?
SQL: SELECT count(DISTINCT dst_apid) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid WHERE T1.name  =  'American Airlines'

Question: Which countries has the most number of airlines?
SQL: SELECT country FROM airlines GROUP BY country ORDER BY count(*) DESC LIMIT 1

Question: What is the name of the country with the most number of home airlines?
SQL: SELECT country FROM airlines GROUP BY country ORDER BY count(*) DESC LIMIT 1

Question: Which countries has the most number of airlines whose active status is 'Y'?
SQL: SELECT country FROM airlines WHERE active  =  'Y' GROUP BY country ORDER BY count(*) DESC LIMIT 1

Question: What are the countries with the most airlines whose active status is Y?
SQL: SELECT country FROM airlines WHERE active  =  'Y' GROUP BY country ORDER BY count(*) DESC LIMIT 1

Question: List all countries and their number of airlines in the descending order of number of airlines.
SQL: SELECT country ,  count(*) FROM airlines GROUP BY country ORDER BY count(*) DESC

Question: How many airlines operate out of each country in descending order?
SQL: SELECT country ,  count(*) FROM airlines GROUP BY country ORDER BY count(*) DESC

Question: How many airports are there per country? Order the countries by decreasing number of airports.
SQL: SELECT count(*) ,  country FROM airports GROUP BY country ORDER BY count(*) DESC

Question: What is the number of airports per country, ordered from most to least?
SQL: SELECT count(*) ,  country FROM airports GROUP BY country ORDER BY count(*) DESC

Question: How many airports are there per city in the United States? Order the cities by decreasing number of airports.
SQL: SELECT count(*) ,  city FROM airports WHERE country  =  'United States' GROUP BY city ORDER BY count(*) DESC

Question: How many airports are there per city in the US ordered from most to least?
SQL: SELECT count(*) ,  city FROM airports WHERE country  =  'United States' GROUP BY city ORDER BY count(*) DESC

Question: Return the cities with more than 3 airports in the United States.
SQL: SELECT city FROM airports WHERE country  =  'United States' GROUP BY city HAVING count(*)  >  3

Question: What is the number of cities in the United States with more than 3 airports?
SQL: SELECT city FROM airports WHERE country  =  'United States' GROUP BY city HAVING count(*)  >  3

Question: How many cities are there that have more than 3 airports?
SQL: SELECT count(*) FROM (SELECT city FROM airports GROUP BY city HAVING count(*)  >  3)

Question: What is the count of cities with more than 3 airports?
SQL: SELECT count(*) FROM (SELECT city FROM airports GROUP BY city HAVING count(*)  >  3)

Question: List the cities which have more than one airport and number of airports.
SQL: SELECT city ,  count(*) FROM airports GROUP BY city HAVING count(*)  >  1

Question: What are the names of all cities with more than one airport and how many airports do they have?
SQL: SELECT city ,  count(*) FROM airports GROUP BY city HAVING count(*)  >  1

Question: List the cities which have more than 2 airports sorted by the number of airports.
SQL: SELECT city FROM airports GROUP BY city HAVING count(*)  >  2 ORDER BY count(*)

Question: What are the cities that have more than 2 airports sorted by number of airports?
SQL: SELECT city FROM airports GROUP BY city HAVING count(*)  >  2 ORDER BY count(*)

Question: Find the number of routes for each source airport and the airport name.
SQL: SELECT count(*) ,  T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.src_apid GROUP BY T1.name

Question: For each airport name, how many routes start at that airport?
SQL: SELECT count(*) ,  T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.src_apid GROUP BY T1.name

Question: Find the number of routes and airport name for each source airport, order the results by decreasing number of routes.
SQL: SELECT count(*) ,  T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.src_apid GROUP BY T1.name ORDER BY count(*) DESC

Question: For each  airport name, how many routes start at that airport, ordered from most to least?
SQL: SELECT count(*) ,  T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.src_apid GROUP BY T1.name ORDER BY count(*) DESC

Question: Find the average elevation of all airports for each country.
SQL: SELECT avg(elevation) ,  country FROM airports GROUP BY country

Question: For each country, what is the average elevation of that country's airports?
SQL: SELECT avg(elevation) ,  country FROM airports GROUP BY country

Question: Find the cities which have exactly two airports.
SQL: SELECT city FROM airports GROUP BY city HAVING count(*)  =  2

Question: What are the cities with exactly two airports?
SQL: SELECT city FROM airports GROUP BY city HAVING count(*)  =  2

Question: For each country and airline name, how many routes are there?
SQL: SELECT T1.country ,  T1.name ,  count(*) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid GROUP BY T1.country ,  T1.name

Question: What is the total number of routes for each country and airline in that country?
SQL: SELECT T1.country ,  T1.name ,  count(*) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid GROUP BY T1.country ,  T1.name

Question: Find the number of routes with destination airports in Italy.
SQL: SELECT count(*) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid  =  T2.apid WHERE T2.country  =  'Italy'

Question: What is the number of routes whose destinations are Italian airports?
SQL: SELECT count(*) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid  =  T2.apid WHERE T2.country  =  'Italy'

Question: Return the number of routes with destination airport in Italy operated by the airline with name 'American Airlines'.
SQL: SELECT count(*) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid  =  T2.apid JOIN airlines AS T3 ON T1.alid  =  T3.alid WHERE T2.country  =  'Italy' AND T3.name  =  'American Airlines'

Question: What is the number of routes operated by the airline American Airlines whose destinations are in Italy?
SQL: SELECT count(*) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid  =  T2.apid JOIN airlines AS T3 ON T1.alid  =  T3.alid WHERE T2.country  =  'Italy' AND T3.name  =  'American Airlines'

Question: Find the number of routes that have destination John F Kennedy International Airport.
SQL: SELECT count(*) FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.dst_apid WHERE T1.name  =  'John F Kennedy International Airport'

Question: What is the number of routes that end at John F Kennedy International Airport?
SQL: SELECT count(*) FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.dst_apid WHERE T1.name  =  'John F Kennedy International Airport'

Question: Find the number of routes from the United States to Canada.
SQL: SELECT count(*) FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country  =  'Canada') AND src_apid IN (SELECT apid FROM airports WHERE country  =  'United States')

Question: How many routes go from the United States to Canada?
SQL: SELECT count(*) FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country  =  'Canada') AND src_apid IN (SELECT apid FROM airports WHERE country  =  'United States')

Question: Find the id of routes whose source and destination airports are in the United States.
SQL: SELECT rid FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country  =  'United States') AND src_apid IN (SELECT apid FROM airports WHERE country  =  'United States')

Question: What is the id of the routes whose source and destination airports are in the United States?
SQL: SELECT rid FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country  =  'United States') AND src_apid IN (SELECT apid FROM airports WHERE country  =  'United States')

Question: Find the name of airline which runs the most number of routes.
SQL: SELECT T1.name FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid GROUP BY T1.name ORDER BY count(*) DESC LIMIT 1

Question: What is the name of the airline with the most routes?
SQL: SELECT T1.name FROM airlines AS T1 JOIN routes AS T2 ON T1.alid  =  T2.alid GROUP BY T1.name ORDER BY count(*) DESC LIMIT 1

Question: Find the busiest source airport that runs most number of routes in China.
SQL: SELECT T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.src_apid WHERE T1.country  =  'China' GROUP BY T1.name ORDER BY count(*) DESC LIMIT 1

Question: What is the name of the airport with the most number of routes that start in China?
SQL: SELECT T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.src_apid WHERE T1.country  =  'China' GROUP BY T1.name ORDER BY count(*) DESC LIMIT 1

Question: Find the busiest destination airport that runs most number of routes in China.
SQL: SELECT T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.dst_apid WHERE T1.country  =  'China' GROUP BY T1.name ORDER BY count(*) DESC LIMIT 1

Question: What is the name of the airport that is the destination of the most number of routes that start in China?
SQL: SELECT T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid  =  T2.dst_apid WHERE T1.country  =  'China' GROUP BY T1.name ORDER BY count(*) DESC LIMIT 1