db_name
stringclasses
146 values
prompt
stringlengths
310
4.81k
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What are the descriptions for the aircrafts? # ### SQL: # # SELECT Description FROM aircraft # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What is the average number of international passengers of all airports? # ### SQL: # # SELECT avg(International_Passengers) FROM airport # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What is the average number of international passengers for an airport? # ### SQL: # # SELECT avg(International_Passengers) FROM airport # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What are the number of international and domestic passengers of the airport named London "Heathrow"? # ### SQL: # # SELECT International_Passengers , Domestic_Passengers FROM airport WHERE Airport_Name = "London Heathrow" # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # How many international and domestic passengers are there in the airport London Heathrow? # ### SQL: # # SELECT International_Passengers , Domestic_Passengers FROM airport WHERE Airport_Name = "London Heathrow" # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What are the total number of Domestic Passengers of airports that contain the word "London". # ### SQL: # # SELECT sum(Domestic_Passengers) FROM airport WHERE Airport_Name LIKE "%London%" # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What are the total number of domestic passengers at all London airports? # ### SQL: # # SELECT sum(Domestic_Passengers) FROM airport WHERE Airport_Name LIKE "%London%" # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What are the maximum and minimum number of transit passengers of all aiports. # ### SQL: # # SELECT max(Transit_Passengers) , min(Transit_Passengers) FROM airport # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What is the maximum and mininum number of transit passengers for all airports? # ### SQL: # # SELECT max(Transit_Passengers) , min(Transit_Passengers) FROM airport # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What are the name of pilots aged 25 or older? # ### SQL: # # SELECT Name FROM pilot WHERE Age >= 25 # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # what is the name of every pilot who is at least 25 years old? # ### SQL: # # SELECT Name FROM pilot WHERE Age >= 25 # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # List all pilot names in ascending alphabetical order. # ### SQL: # # SELECT Name FROM pilot ORDER BY Name ASC # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What are the names of the pilots in alphabetical order? # ### SQL: # # SELECT Name FROM pilot ORDER BY Name ASC # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # List names of all pilot aged 30 or younger in descending alphabetical order. # ### SQL: # # SELECT Name FROM pilot WHERE Age <= 30 ORDER BY Name DESC # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What are the names of all pilots 30 years old or young in descending alphabetical order? # ### SQL: # # SELECT Name FROM pilot WHERE Age <= 30 ORDER BY Name DESC # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # Please show the names of aircrafts associated with airport with name "London Gatwick". # ### SQL: # # SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Gatwick" # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What are the names of all the aircrafts associated with London Gatwick airport? # ### SQL: # # SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Gatwick" # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # Please show the names and descriptions of aircrafts associated with airports that have a total number of passengers bigger than 10000000. # ### SQL: # # SELECT T1.Aircraft , T1.Description FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Total_Passengers > 10000000 # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What are the names and descriptions of aircrafts associated with an airport that has more total passengers than 10000000? # ### SQL: # # SELECT T1.Aircraft , T1.Description FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Total_Passengers > 10000000 # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What is the average total number of passengers of airports that are associated with aircraft "Robinson R-22"? # ### SQL: # # SELECT avg(T3.Total_Passengers) FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T1.Aircraft = "Robinson R-22" # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What is the average total number of passengers for all airports that the aircraft "Robinson R-22" visits? # ### SQL: # # SELECT avg(T3.Total_Passengers) FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T1.Aircraft = "Robinson R-22" # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # Please list the location and the winning aircraft name. # ### SQL: # # SELECT T2.Location , T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What is the location and name of the winning aircraft? # ### SQL: # # SELECT T2.Location , T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # List the name of the aircraft that has been named winning aircraft the most number of times. # ### SQL: # # SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft ORDER BY COUNT(*) DESC LIMIT 1 # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What is the name of the aircraft that has won an award the most? # ### SQL: # # SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft ORDER BY COUNT(*) DESC LIMIT 1 # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # List the names of aircrafts and the number of times it won matches. # ### SQL: # # SELECT T1.Aircraft , COUNT(*) FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # For each aircraft that has won an award, what is its name and how many time has it won? # ### SQL: # # SELECT T1.Aircraft , COUNT(*) FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # List names of all pilot in descending order of age. # ### SQL: # # SELECT Name FROM pilot ORDER BY Age DESC # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What are the names of all pilots listed by descending age? # ### SQL: # # SELECT Name FROM pilot ORDER BY Age DESC # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # List the names of aircrafts and that won matches at least twice. # ### SQL: # # SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft HAVING COUNT(*) >= 2 # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What are the names of all aircrafts that have won a match at least twice? # ### SQL: # # SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft HAVING COUNT(*) >= 2 # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # List the names of aircrafts and that did not win any match. # ### SQL: # # SELECT Aircraft FROM aircraft WHERE Aircraft_ID NOT IN (SELECT Winning_Aircraft FROM MATCH) # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What are the names of all aicrafts that have never won any match? # ### SQL: # # SELECT Aircraft FROM aircraft WHERE Aircraft_ID NOT IN (SELECT Winning_Aircraft FROM MATCH) # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # Show the names of aircrafts that are associated with both an airport named "London Heathrow" and an airport named "London Gatwick" # ### SQL: # # SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Heathrow" INTERSECT SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Gatwick" # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What are the names of all aircrafts that are associated with both London Heathrow and Gatwick airports? # ### SQL: # # SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Heathrow" INTERSECT SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Gatwick" # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # Show all information on the airport that has the largest number of international passengers. # ### SQL: # # SELECT * FROM airport ORDER BY International_Passengers DESC LIMIT 1 # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What is all the information on the airport with the largest number of international passengers? # ### SQL: # # SELECT * FROM airport ORDER BY International_Passengers DESC LIMIT 1 # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # find the name and age of the pilot who has won the most number of times among the pilots who are younger than 30. # ### SQL: # # SELECT t1.name , t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id = t2.winning_pilot WHERE t1.age < 30 GROUP BY t2.winning_pilot ORDER BY count(*) DESC LIMIT 1 # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What is the name and age of the pilot younger than 30 who has won the most number of times? # ### SQL: # # SELECT t1.name , t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id = t2.winning_pilot WHERE t1.age < 30 GROUP BY t2.winning_pilot ORDER BY count(*) DESC LIMIT 1 # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # what is the name and age of the youngest winning pilot? # ### SQL: # # SELECT t1.name , t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id = t2.winning_pilot ORDER BY t1.age LIMIT 1 # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # How old is the youngest winning pilot and what is their name? # ### SQL: # # SELECT t1.name , t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id = t2.winning_pilot ORDER BY t1.age LIMIT 1 # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # find the name of pilots who did not win the matches held in the country of Australia. # ### SQL: # # SELECT name FROM pilot WHERE pilot_id NOT IN (SELECT Winning_Pilot FROM MATCH WHERE country = 'Australia') # ### End.
aircraft
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # pilot ( Pilot_Id, Name, Age ) # aircraft ( Aircraft_ID, Aircraft, Description, Max_Gross_Weight, Total_disk_area, Max_disk_Loading ) # match ( Round, Location, Country, Date, Fastest_Qualifying, Winning_Pilot, Winning_Aircraft ) # airport ( Airport_ID, Airport_Name, Total_Passengers, %_Change_2007, International_Passengers, Domestic_Passengers, Transit_Passengers, Aircraft_Movements, Freight_Metric_Tonnes ) # airport_aircraft ( ID, Airport_ID, Aircraft_ID ) # # match.Winning_Pilot can be joined with pilot.Pilot_Id # match.Winning_Aircraft can be joined with aircraft.Aircraft_ID # airport_aircraft.Aircraft_ID can be joined with aircraft.Aircraft_ID # airport_aircraft.Airport_ID can be joined with airport.Airport_ID # ### Question: # # What are the names of the pilots that have not won any matches in Australia? # ### SQL: # # SELECT name FROM pilot WHERE pilot_id NOT IN (SELECT Winning_Pilot FROM MATCH WHERE country = 'Australia') # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # How many residents does each property have? List property id and resident count. # ### SQL: # # SELECT T1.property_id , count(*) FROM properties AS T1 JOIN residents AS T2 ON T1.property_id = T2.property_id GROUP BY T1.property_id # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # What is the distinct service types that are provided by the organization which has detail 'Denesik and Sons Party'? # ### SQL: # # SELECT DISTINCT T1.service_type_code FROM services AS T1 JOIN organizations AS T2 ON T1.organization_id = T2.organization_id WHERE T2.organization_details = 'Denesik and Sons Party' # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # How many services has each resident requested? List the resident id, details, and the count in descending order of the count. # ### SQL: # # SELECT T1.resident_id , T1.other_details , count(*) FROM Residents AS T1 JOIN Residents_Services AS T2 ON T1.resident_id = T2.resident_id GROUP BY T1.resident_id ORDER BY count(*) DESC # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # What is the maximum number that a certain service is provided? List the service id, details and number. # ### SQL: # # SELECT T1.service_id , T1.service_details , count(*) FROM Services AS T1 JOIN Residents_Services AS T2 ON T1.service_id = T2.service_id GROUP BY T1.service_id ORDER BY count(*) DESC LIMIT 1 # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # List the id and type of each thing, and the details of the organization that owns it. # ### SQL: # # SELECT T1.thing_id , T1.type_of_Thing_Code , T2.organization_details FROM Things AS T1 JOIN Organizations AS T2 ON T1.organization_id = T2.organization_id # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # What are the id and details of the customers who have at least 3 events? # ### SQL: # # SELECT T1.customer_id , T1.customer_details FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 3 # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # What is each customer's move in date, and the corresponding customer id and details? # ### SQL: # # SELECT T2.date_moved_in , T1.customer_id , T1.customer_details FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # Which events have the number of notes between one and three? List the event id and the property id. # ### SQL: # # SELECT T1.Customer_Event_ID , T1.property_id FROM Customer_Events AS T1 JOIN Customer_Event_Notes AS T2 ON T1.Customer_Event_ID = T2.Customer_Event_ID GROUP BY T1.customer_event_id HAVING count(*) BETWEEN 1 AND 3 # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # What are the distinct id and type of the thing that has the status 'Close' or has a status record before the date '2017-06-19 02:59:21' # ### SQL: # # SELECT DISTINCT T2.thing_id , T2.Type_of_Thing_Code FROM Timed_Status_of_Things AS T1 JOIN Things AS T2 ON T1.thing_id = T2.thing_id WHERE T1.Status_of_Thing_Code = 'Close' OR T1.Date_and_Date < '2017-06-19 02:59:21' # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # How many distinct locations have the things with service detail 'Unsatisfied' been located in? # ### SQL: # # SELECT count(DISTINCT T2.Location_Code) FROM Things AS T1 JOIN Timed_Locations_of_Things AS T2 ON T1.thing_id = T2.thing_id WHERE T1.service_details = 'Unsatisfied' # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # How many different status codes of things are there? # ### SQL: # # SELECT count(DISTINCT Status_of_Thing_Code) FROM Timed_Status_of_Things # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # Which organizations are not a parent organization of others? List the organization id. # ### SQL: # # SELECT organization_id FROM organizations EXCEPT SELECT parent_organization_id FROM organizations # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # When is the last day any resident moved in? # ### SQL: # # SELECT max(date_moved_in) FROM Residents # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # What are the resident details containing the substring 'Miss'? # ### SQL: # # SELECT other_details FROM Residents WHERE other_details LIKE '%Miss%' # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # List the customer event id and the corresponding move in date and property id. # ### SQL: # # SELECT customer_event_id , date_moved_in , property_id FROM customer_events # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # How many customers did not have any event? # ### SQL: # # SELECT count(*) FROM customers WHERE customer_id NOT IN ( SELECT customer_id FROM customer_events ) # ### End.
local_govt_and_lot
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # Customers ( customer_id, customer_details ) # Properties ( property_id, property_type_code, property_address, other_details ) # Residents ( resident_id, property_id, date_moved_in, date_moved_out, other_details ) # Organizations ( organization_id, parent_organization_id, organization_details ) # Services ( service_id, organization_id, service_type_code, service_details ) # Residents_Services ( resident_id, service_id, date_moved_in, property_id, date_requested, date_provided, other_details ) # Things ( thing_id, organization_id, Type_of_Thing_Code, service_type_code, service_details ) # Customer_Events ( Customer_Event_ID, customer_id, date_moved_in, property_id, resident_id, thing_id ) # Customer_Event_Notes ( Customer_Event_Note_ID, Customer_Event_ID, service_type_code, resident_id, property_id, date_moved_in ) # Timed_Status_of_Things ( thing_id, Date_and_Date, Status_of_Thing_Code ) # Timed_Locations_of_Things ( thing_id, Date_and_Time, Location_Code ) # # Residents.property_id can be joined with Properties.property_id # Services.organization_id can be joined with Organizations.organization_id # Residents_Services.resident_id can be joined with Residents.resident_id # Residents_Services.property_id can be joined with Residents.property_id # Residents_Services.date_moved_in can be joined with Residents.date_moved_in # Residents_Services.service_id can be joined with Services.service_id # Things.organization_id can be joined with Organizations.organization_id # Customer_Events.resident_id can be joined with Residents.resident_id # Customer_Events.property_id can be joined with Residents.property_id # Customer_Events.date_moved_in can be joined with Residents.date_moved_in # Customer_Events.customer_id can be joined with Customers.customer_id # Customer_Events.thing_id can be joined with Things.thing_id # Customer_Event_Notes.Customer_Event_ID can be joined with Customer_Events.Customer_Event_ID # Timed_Status_of_Things.thing_id can be joined with Things.thing_id # Timed_Locations_of_Things.thing_id can be joined with Things.thing_id # ### Question: # # What are the distinct move in dates of the residents? # ### SQL: # # SELECT DISTINCT date_moved_in FROM residents # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # How many schools are there? # ### SQL: # # SELECT count(*) FROM school # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Count the number of schools. # ### SQL: # # SELECT count(*) FROM school # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # List the locations of schools in ascending order of enrollment. # ### SQL: # # SELECT LOCATION FROM school ORDER BY Enrollment ASC # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # What is the list of school locations sorted in ascending order of school enrollment? # ### SQL: # # SELECT LOCATION FROM school ORDER BY Enrollment ASC # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # List the locations of schools in descending order of founded year. # ### SQL: # # SELECT LOCATION FROM school ORDER BY Founded DESC # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # What is the list of school locations sorted in descending order of school foundation year? # ### SQL: # # SELECT LOCATION FROM school ORDER BY Founded DESC # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # What are the enrollments of schools whose denomination is not "Catholic"? # ### SQL: # # SELECT Enrollment FROM school WHERE Denomination != "Catholic" # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # List the enrollment for each school that does not have "Catholic" as denomination. # ### SQL: # # SELECT Enrollment FROM school WHERE Denomination != "Catholic" # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # What is the average enrollment of schools? # ### SQL: # # SELECT avg(Enrollment) FROM school # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Take the average of the school enrollment. # ### SQL: # # SELECT avg(Enrollment) FROM school # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # What are the teams of the players, sorted in ascending alphabetical order? # ### SQL: # # SELECT Team FROM player ORDER BY Team ASC # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Find the team of each player and sort them in ascending alphabetical order. # ### SQL: # # SELECT Team FROM player ORDER BY Team ASC # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # How many different positions of players are there? # ### SQL: # # SELECT count(DISTINCT POSITION) FROM player # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Count the number of distinct player positions. # ### SQL: # # SELECT count(DISTINCT POSITION) FROM player # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Find the team of the player of the highest age. # ### SQL: # # SELECT Team FROM player ORDER BY Age DESC LIMIT 1 # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Which team has the oldest player? # ### SQL: # # SELECT Team FROM player ORDER BY Age DESC LIMIT 1 # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # List the teams of the players with the top 5 largest ages. # ### SQL: # # SELECT Team FROM player ORDER BY Age DESC LIMIT 5 # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # What are the teams that have the 5 oldest players? # ### SQL: # # SELECT Team FROM player ORDER BY Age DESC LIMIT 5 # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # For each player, show the team and the location of school they belong to. # ### SQL: # # SELECT T1.Team , T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # What are the team and the location of school each player belongs to? # ### SQL: # # SELECT T1.Team , T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Show the locations of schools that have more than 1 player. # ### SQL: # # SELECT T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID HAVING COUNT(*) > 1 # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Which schools have more than 1 player? Give me the school locations. # ### SQL: # # SELECT T2.Location FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID HAVING COUNT(*) > 1 # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Show the denomination of the school that has the most players. # ### SQL: # # SELECT T2.Denomination FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID ORDER BY COUNT(*) DESC LIMIT 1 # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # What is the denomination of the school the most players belong to? # ### SQL: # # SELECT T2.Denomination FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID ORDER BY COUNT(*) DESC LIMIT 1 # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Show locations and nicknames of schools. # ### SQL: # # SELECT T1.Location , T2.Nickname FROM school AS T1 JOIN school_details AS T2 ON T1.School_ID = T2.School_ID # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # What are the location and nickname of each school? # ### SQL: # # SELECT T1.Location , T2.Nickname FROM school AS T1 JOIN school_details AS T2 ON T1.School_ID = T2.School_ID # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Please show different denominations and the corresponding number of schools. # ### SQL: # # SELECT Denomination , COUNT(*) FROM school GROUP BY Denomination # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # For each denomination, return the denomination and the count of schools with that denomination. # ### SQL: # # SELECT Denomination , COUNT(*) FROM school GROUP BY Denomination # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Please show different denominations and the corresponding number of schools in descending order. # ### SQL: # # SELECT Denomination , COUNT(*) FROM school GROUP BY Denomination ORDER BY COUNT(*) DESC # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Order denominations in descending order of the count of schools with the denomination. Return each denomination with the count of schools. # ### SQL: # # SELECT Denomination , COUNT(*) FROM school GROUP BY Denomination ORDER BY COUNT(*) DESC # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # List the school color of the school that has the largest enrollment. # ### SQL: # # SELECT School_Colors FROM school ORDER BY Enrollment DESC LIMIT 1 # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # What is the school color of the school with the largest enrollment? # ### SQL: # # SELECT School_Colors FROM school ORDER BY Enrollment DESC LIMIT 1 # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # List the locations of schools that do not have any player. # ### SQL: # # SELECT LOCATION FROM school WHERE School_ID NOT IN (SELECT School_ID FROM Player) # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Which schools do not have any player? Give me the school locations. # ### SQL: # # SELECT LOCATION FROM school WHERE School_ID NOT IN (SELECT School_ID FROM Player) # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Show the denomination shared by schools founded before 1890 and schools founded after 1900 # ### SQL: # # SELECT Denomination FROM school WHERE Founded < 1890 INTERSECT SELECT Denomination FROM school WHERE Founded > 1900 # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # What are the denominations used by both schools founded before 1890 and schools founded after 1900? # ### SQL: # # SELECT Denomination FROM school WHERE Founded < 1890 INTERSECT SELECT Denomination FROM school WHERE Founded > 1900 # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Show the nicknames of schools that are not in division 1. # ### SQL: # # SELECT Nickname FROM school_details WHERE Division != "Division 1" # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # What are the nicknames of schools whose division is not 1? # ### SQL: # # SELECT Nickname FROM school_details WHERE Division != "Division 1" # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # Show the denomination shared by more than one school. # ### SQL: # # SELECT Denomination FROM school GROUP BY Denomination HAVING COUNT(*) > 1 # ### End.
school_player
### Complete SQL query only and with no explanation ### SQL tables followed by foreign key information: # # school ( School_ID, School, Location, Enrollment, Founded, Denomination, Boys_or_Girls, Day_or_Boarding, Year_Entered_Competition, School_Colors ) # school_details ( School_ID, Nickname, Colors, League, Class, Division ) # school_performance ( School_Id, School_Year, Class_A, Class_AA ) # player ( Player_ID, Player, Team, Age, Position, School_ID ) # # school_details.School_ID can be joined with school.School_ID # school_performance.School_Id can be joined with school.School_ID # player.School_ID can be joined with school.School_ID # ### Question: # # What are the denomination more than one school have? # ### SQL: # # SELECT Denomination FROM school GROUP BY Denomination HAVING COUNT(*) > 1 # ### End.