db_id
stringlengths
4
31
SQL
stringlengths
18
1.45k
input_sequence
stringlengths
148
11k
question
stringlengths
16
325
activity_1
select t1.lname from faculty as t1 join faculty_participates_in as t2 on t1.facid = t2.facid join activity as t3 on t2.actid = t2.actid where t3.activity_name = 'canoeing' intersect select t1.lname from faculty as t1 join faculty_participates_in as t2 on t1.facid = t2.facid join activity as t3 on t2.actid = t...
Question: what are the first names of the faculty members playing both canoeing and kayaking? | Tables: Activity -> actid, activity_name. Participates_in -> stuid, actid. Faculty_Participates_in -> FacID, actid. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Faculty -> FacID, Lname, Fname, Rank, S...
what are the first names of the faculty members playing both canoeing and kayaking?
activity_1
select t1.stuid from participates_in as t1 join activity as t2 on t2.actid = t2.actid where t2.activity_name = 'canoeing' intersect select t1.stuid from participates_in as t1 join activity as t2 on t2.actid = t2.actid where t2.activity_name = 'kayaking'
Question: find the ids of the students who participate in canoeing and kayaking. | Tables: Activity -> actid, activity_name. Participates_in -> stuid, actid. Faculty_Participates_in -> FacID, actid. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Faculty -> FacID, Lname, Fname, Rank, Sex, Phone, Ro...
find the ids of the students who participate in canoeing and kayaking.
activity_1
select t1.stuid from participates_in as t1 join activity as t2 on t2.actid = t2.actid where t2.activity_name = 'canoeing' intersect select t1.stuid from participates_in as t1 join activity as t2 on t2.actid = t2.actid where t2.activity_name = 'kayaking'
Question: which students participate in both canoeing and kayaking as their activities? tell me their student ids. | Tables: Activity -> actid, activity_name. Participates_in -> stuid, actid. Faculty_Participates_in -> FacID, actid. Student -> StuID, LName, Fname, Age, Sex, Major, Advisor, city_code. Faculty -> FacID, ...
which students participate in both canoeing and kayaking as their activities? tell me their student ids.
flight_4
select name from airports where city = 'goroka'
Question: find the name of the airport in the city of goroka. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.alid, ro...
find the name of the airport in the city of goroka.
flight_4
select name from airports where city = 'goroka'
Question: what are the names of the airports in the city of goroka? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.al...
what are the names of the airports in the city of goroka?
flight_4
select name , city , country , elevation from airports where city = 'new york'
Question: find the name, city, country, and altitude (or elevation) of the airports in the city of new york. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, a...
find the name, city, country, and altitude (or elevation) of the airports in the city of new york.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | ...
what is the name, city, country, and elevation for every airport in the city of new york?
flight_4
select count(*) from airlines
Question: how many airlines are there? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.alid, routes.src_apid = airport...
how many airlines are there?
flight_4
select count(*) from airlines
Question: what is the total number of airlines? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.alid, routes.src_apid ...
what is the total number of airlines?
flight_4
select count(*) from airlines where country = 'russia'
Question: how many airlines does russia has? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.alid, routes.src_apid = a...
how many airlines does russia has?
flight_4
select count(*) from airlines where country = 'russia'
Question: what is the number of airlines based in russia? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.alid, routes...
what is the number of airlines based in russia?
flight_4
select max(elevation) from airports where country = 'iceland'
Question: what is the maximum elevation of all airports in the country of iceland? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.ali...
what is the maximum elevation of all airports in the country of iceland?
flight_4
select max(elevation) from airports where country = 'iceland'
Question: what is the highest elevation of an airport in the country of iceland? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid ...
what is the highest elevation of an airport in the country of iceland?
flight_4
select name from airports where country = 'cuba' or country = 'argentina'
Question: find the name of the airports located in cuba or argentina. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines....
find the name of the airports located in cuba or argentina.
flight_4
select name from airports where country = 'cuba' or country = 'argentina'
Question: what are the names of all airports in cuba or argentina? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.ali...
what are the names of all airports in cuba or argentina?
flight_4
select country from airlines where name like 'orbit%'
Question: find the country of the airlines whose name starts with 'orbit'. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airl...
find the country of the airlines whose name starts with 'orbit'.
flight_4
select country from airlines where name like 'orbit%'
Question: what are the countries of all airlines whose names start with orbit? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = ...
what are the countries of all airlines whose names start with orbit?
flight_4
select name from airports where elevation between -50 and 50
Question: find the name of airports whose altitude is between -50 and 50. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airli...
find the name of airports whose altitude is between -50 and 50.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.al...
what are the names of all airports whose elevation is between -50 and 50?
flight_4
select country from airports order by elevation desc limit 1
Question: which country is the airport that has the highest altitude located in? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid ...
which country is the airport that has the highest altitude located in?
flight_4
select country from airports order by elevation desc limit 1
Question: what is the country of the airport with the highest elevation? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlin...
what is the country of the airport with the highest elevation?
flight_4
select count(*) from airports where name like '%international%'
Question: find the number of airports whose name contain the word 'international'. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.ali...
find the number of airports whose name contain the word 'international'.
flight_4
select count(*) from airports where name like '%international%'
Question: how many airports' names have the word interanation in them? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines...
how many airports' names have the word interanation in them?
flight_4
select count(distinct city) from airports where country = 'greenland'
Question: how many different cities do have some airport in the country of greenland? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes....
how many different cities do have some airport in the country of greenland?
flight_4
select count(distinct city) from airports where country = 'greenland'
Question: in how many cities are there airports in the country of greenland? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = ai...
in how many cities are there airports in the country of greenland?
flight_4
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 operated by american airlines. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.ali...
find the number of routes operated by american airlines.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.alid, routes...
how many routes does american airlines operate?
flight_4
select count(*) from airports as t1 join routes as t2 on t1.apid = t2.dst_apid where country = 'canada'
Question: find the number of routes whose destination airports are in canada. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = a...
find the number of routes whose destination airports are in canada.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.alid, routes.src_...
how many routes end in a canadian airport?
flight_4
select name , city , country from airports order by elevation limit 1
Question: find the name, city, and country of the airport that has the lowest altitude. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: route...
find the name, city, and country of the airport that has the lowest altitude.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes...
what is the name, city, and country of the airport with the lowest altitude?
flight_4
select name , city , country from airports order by elevation desc limit 1
Question: find the name, city, and country of the airport that has the highest latitude. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: rout...
find the name, city, and country of the airport that has the highest latitude.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: rout...
what is the name, city, and country of the airport with the highest elevation?
flight_4
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 name and city of the airport which is the destination of the most number of routes. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active....
find the name and city of the airport which is the destination of the most number of routes.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid =...
what is the name and city of the airport that the most routes end at?
flight_4
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 names of the top 10 airlines that operate the most number of routes. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: route...
find the names of the top 10 airlines that operate the most number of routes.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: rou...
for the airline ids with the top 10 most routes operated, what are their names?
flight_4
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 name and city of the airport which is the source for the most number of flight routes. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, acti...
find the name and city of the airport which is the source for the most number of flight routes.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid...
what is the name and city of the airport from most of the routes start?
flight_4
select count(distinct dst_apid) from airlines as t1 join routes as t2 on t1.alid = t2.alid where t1.name = 'american airlines'
Question: find the number of different airports which are the destinations of the american airlines. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. |...
find the number of different airports which are the destinations of the american airlines.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, acti...
what is the number of different different airports that are destinations for american airlines?
flight_4
select country from airlines group by country order by count(*) desc limit 1
Question: which countries has the most number of airlines? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.alid, route...
which countries has the most number of airlines?
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid ...
what is the name of the country with the most number of home airlines?
flight_4
select country from airlines where active = 'y' group by country order by count(*) desc limit 1
Question: which countries has the most number of airlines whose active status is 'y'? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes....
which countries has the most number of airlines whose active status is 'y'?
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid...
what are the countries with the most airlines whose active status is y?
flight_4
select country , count(*) from airlines group by country order by count(*) desc
Question: list all countries and their number of airlines in the descending order of number of airlines. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, activ...
list all countries and their number of airlines in the descending order of number of airlines.
flight_4
select country , count(*) from airlines group by country order by count(*) desc
Question: how many airlines operate out of each country in descending order? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = ai...
how many airlines operate out of each country in descending order?
flight_4
select count(*) , country from airports group by country order by count(*) desc
Question: how many airports are there per country? order the countries by decreasing number of airports. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, activ...
how many airports are there per country? order the countries by decreasing number of airports.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid...
what is the number of airports per country, ordered from most to least?
flight_4
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 united states? order the cities by decreasing number of airports. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign,...
how many airports are there per city in the united states? order the cities by decreasing number of airports.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.a...
how many airports are there per city in the us ordered from most to least?
flight_4
select city from airports where country = 'united states' group by city having count(*) > 3
Question: return the cities with more than 3 airports in the united states. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = air...
return the cities with more than 3 airports in the united states.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes...
what is the number of cities in the united states with more than 3 airports?
flight_4
select count(*) from (select city from airports group by city having count(*) > 3)
Question: how many cities are there that have more than 3 airports? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.al...
how many cities are there that have more than 3 airports?
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.alid,...
what is the count of cities with more than 3 airports?
flight_4
select city , count(*) from airports group by city having count(*) > 1
Question: list the cities which have more than one airport and number of airports. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.ali...
list the cities which have more than one airport and number of airports.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, acti...
what are the names of all cities with more than one airport and how many airports do they have?
flight_4
select city from airports group by city having count(*) > 2 order by count(*)
Question: list the cities which have more than 2 airports sorted by the number of airports. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: r...
list the cities which have more than 2 airports sorted by the number of airports.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: ro...
what are the cities that have more than 2 airports sorted by number of airports?
flight_4
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 for each source airport and the airport name. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid...
find the number of routes for each source airport and the airport name.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airline...
for each airport name, how many routes start at that airport?
flight_4
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 number of routes and airport name for each source airport, order the results by decreasing number of routes. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, c...
find the number of routes and airport name for each source airport, order the results by decreasing number of routes.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. |...
for each airport name, how many routes start at that airport, ordered from most to least?
flight_4
select avg(elevation) , country from airports group by country
Question: find the average elevation of all airports for each country. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines...
find the average elevation of all airports for each country.
flight_4
select avg(elevation) , country from airports group by country
Question: for each country, what is the average elevation of that country's airports? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes....
for each country, what is the average elevation of that country's airports?
flight_4
select city from airports group by city having count(*) = 2
Question: find the cities which have exactly two airports. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.alid, route...
find the cities which have exactly two airports.
flight_4
select city from airports group by city having count(*) = 2
Question: what are the cities with exactly two airports? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.alid, routes....
what are the cities with exactly two airports?
flight_4
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: for each country and airline name, how many routes are there? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airline...
for each country and airline name, how many routes are there?
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: ro...
what is the total number of routes for each country and airline in that country?
flight_4
select count(*) from routes as t1 join airports as t2 on t1.dst_apid = t2.apid where t2.country = 'italy'
Question: find the number of routes with destination airports in italy. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airline...
find the number of routes with destination airports in italy.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid =...
what is the number of routes whose destinations are italian airports?
flight_4
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: return the number of routes with destination airport in italy operated by the airline with name 'american airlines'. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, ca...
return the number of routes with destination airport in italy operated by the airline with name 'american airlines'.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, count...
what is the number of routes operated by the airline american airlines whose destinations are in italy?
flight_4
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 that have destination john f kennedy international airport. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Join...
find the number of routes that have destination john f kennedy international airport.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: rout...
what is the number of routes that end at john f kennedy international airport?
flight_4
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 number of routes from the united states to canada. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines....
find the number of routes from the united states to canada.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.alid, r...
how many routes go from the united states to canada?
flight_4
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 id of routes whose source and destination airports are in the united states. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Join...
find the id of routes whose source and destination airports are in the united states.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active....
what is the id of the routes whose source and destination airports are in the united states?
flight_4
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 name of airline which runs the most number of routes. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlin...
find the name of airline which runs the most number of routes.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.alid = airlines.alid, ...
what is the name of the airline with the most routes?
flight_4
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 source airport that runs most number of routes in china. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: routes.al...
find the busiest source airport that runs most number of routes in china.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins:...
what is the name of the airport with the most number of routes that start in china?
flight_4
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: find the busiest destination airport that runs most number of routes in china. | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, country, active. | Joins: rout...
find the busiest destination airport that runs most number of routes in china.
flight_4
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? | Tables: routes -> rid, dst_apid, dst_ap, src_apid, src_ap, alid, airline, codeshare. airports -> apid, name, city, country, x, y, elevation, iata, icao. airlines -> alid, name, iata, icao, callsign, cou...
what is the name of the airport that is the destination of the most number of routes that start in china?
tracking_orders
select order_id from orders order by date_order_placed desc limit 1
Question: what is the id of the most recent order? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, product_details. Order...
what is the id of the most recent order?
tracking_orders
select order_id from orders order by date_order_placed desc limit 1
Question: find the id of the order made most recently. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, product_details. O...
find the id of the order made most recently.
tracking_orders
select order_id , customer_id from orders order by date_order_placed limit 1
Question: what are the order id and customer id of the oldest order? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, prod...
what are the order id and customer id of the oldest order?
tracking_orders
select order_id , customer_id from orders order by date_order_placed limit 1
Question: find the order id and customer id associated with the oldest order. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_n...
find the order id and customer id associated with the oldest order.
tracking_orders
select order_id from shipments where shipment_tracking_number = '3452'
Question: find the id of the order whose shipment tracking number is '3452'. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_na...
find the id of the order whose shipment tracking number is '3452'.
tracking_orders
select order_id from shipments where shipment_tracking_number = '3452'
Question: which order's shipment tracking number is '3452'? give me the id of the order. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id...
which order's shipment tracking number is '3452'? give me the id of the order.
tracking_orders
select order_item_id from order_items where product_id = 11
Question: find the ids of all the order items whose product id is 11. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, pro...
find the ids of all the order items whose product id is 11.
tracking_orders
select order_item_id from order_items where product_id = 11
Question: find all the order items whose product id is 11. what are the order item ids? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id,...
find all the order items whose product id is 11. what are the order item ids?
tracking_orders
select distinct t1.customer_name from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t2.order_status = 'packing'
Question: list the name of all the distinct customers who have orders with status 'packing'. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> produc...
list the name of all the distinct customers who have orders with status 'packing'.
tracking_orders
select distinct t1.customer_name from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t2.order_status = 'packing'
Question: which customers have orders with status 'packing'? give me the customer names. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id...
which customers have orders with status 'packing'? give me the customer names.
tracking_orders
select distinct t1.customer_details from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t2.order_status = 'on road'
Question: find the details of all the distinct customers who have orders with status 'on road'. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> pro...
find the details of all the distinct customers who have orders with status 'on road'.
tracking_orders
select distinct t1.customer_details from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t2.order_status = 'on road'
Question: what are the distinct customers who have orders with status 'on road'? give me the customer details? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. ...
what are the distinct customers who have orders with status 'on road'? give me the customer details?
tracking_orders
select t1.customer_name from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id group by t1.customer_id order by count(*) desc limit 1
Question: what is the name of the customer who has the most orders? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, produ...
what is the name of the customer who has the most orders?
tracking_orders
select t1.customer_name from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id group by t1.customer_id order by count(*) desc limit 1
Question: which customer made the most orders? find the customer name. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, pr...
which customer made the most orders? find the customer name.
tracking_orders
select t1.customer_id from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id group by t1.customer_id order by count(*) desc limit 1
Question: what is the customer id of the customer who has the most orders? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name...
what is the customer id of the customer who has the most orders?