nl stringlengths 22 185 | sql stringlengths 22 608 | db_id stringclasses 40
values | table_schema stringclasses 305
values |
|---|---|---|---|
Return the names of pilots who are younger than average, ordered by age ascending. | SELECT pilot_name FROM PilotSkills WHERE age < (SELECT avg(age) FROM PilotSkills) ORDER BY age | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Find all information of on pilots whose age is less than 30. | SELECT * FROM PilotSkills WHERE age < 30 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What is all the information about pilots who are younger than 30 ? | select * from pilotskills where age < 30 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Find the names of all pilots who have a plane named Piper Cub and is under 35. | SELECT pilot_name FROM PilotSkills WHERE age < 35 AND plane_name = 'Piper Cub' | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What are the names of pilots who are younger than 35 and have a plane named Piper Cub? | SELECT pilot_name FROM PilotSkills WHERE age < 35 AND plane_name = 'Piper Cub' | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Where is the plane F-14 Fighter located? | SELECT LOCATION FROM hangar WHERE plane_name = 'F-14 Fighter' | pilot_1 | [{'table_name': 'hangar', 'table_schema': [{'col_name': 'plane name'}, {'col_name': 'location'}], 'foreign_key_columns': [], 'primary_keys': ['plane name']}] |
Return the location of the hangar in which F-14 Fighter is located. | SELECT LOCATION FROM hangar WHERE plane_name = 'F-14 Fighter' | pilot_1 | [{'table_name': 'hangar', 'table_schema': [{'col_name': 'plane name'}, {'col_name': 'location'}], 'foreign_key_columns': [], 'primary_keys': ['plane name']}] |
How many different places have some plane? | SELECT count(DISTINCT LOCATION) FROM hangar | pilot_1 | [{'table_name': 'hangar', 'table_schema': [{'col_name': 'plane name'}, {'col_name': 'location'}], 'foreign_key_columns': [], 'primary_keys': ['plane name']}] |
Count the number of different locations of hangars. | SELECT count(DISTINCT LOCATION) FROM hangar | pilot_1 | [{'table_name': 'hangar', 'table_schema': [{'col_name': 'plane name'}, {'col_name': 'location'}], 'foreign_key_columns': [], 'primary_keys': ['plane name']}] |
Which plane does the pilot Jones with age 32 has? | SELECT plane_name FROM pilotskills WHERE pilot_name = 'Jones' AND age = 32 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What are the names of planes that the pilot Jones who is 32 has? | SELECT plane_name FROM pilotskills WHERE pilot_name = 'Jones' AND age = 32 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
How many pilots who are older than 40? | SELECT count(*) FROM pilotskills WHERE age > 40 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Count the number of pilots with age greater than 40. | SELECT count(*) FROM pilotskills WHERE age > 40 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
How many plane B-52 Bomber owned by the pilot who is under 35? | SELECT count(*) FROM pilotskills WHERE age < 35 AND plane_name = 'B-52 Bomber' | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Count the number of B-52 Bombers owned by pilots under 35. | SELECT count(*) FROM pilotskills WHERE age < 35 AND plane_name = 'B-52 Bomber' | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Who is the youngest pilot to fly the plane Piper Cub? | SELECT pilot_name FROM pilotskills WHERE plane_name = 'Piper Cub' ORDER BY age LIMIT 1 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Return the name of the youngest pilot to fly Piper Cub. | SELECT pilot_name FROM pilotskills WHERE plane_name = 'Piper Cub' ORDER BY age LIMIT 1 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What is the name of the most popular plane? | SELECT plane_name FROM pilotskills GROUP BY plane_name ORDER BY count(*) DESC LIMIT 1 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What is the name of the plane that is flown the most often? | SELECT plane_name FROM pilotskills GROUP BY plane_name ORDER BY count(*) DESC LIMIT 1 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What is the name of the least popular plane? | SELECT plane_name FROM pilotskills GROUP BY plane_name ORDER BY count(*) LIMIT 1 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What is the name of the plane that is flown the least often? | SELECT plane_name FROM pilotskills GROUP BY plane_name ORDER BY count(*) LIMIT 1 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
How many pilots whose planes are in Chicago? | SELECT count(DISTINCT T1.pilot_name) FROM pilotskills AS T1 JOIN hangar AS T2 ON T1.plane_name = T2.plane_name WHERE T2.location = 'Chicago' | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}, {'table_name': 'hangar', 'table_schema': [{'col_name': 'plane name'}, {'col_name': 'location'}], 'foreign_key_columns': [... |
Count the number of pilots who have planes in Chicago. | SELECT count(DISTINCT T1.pilot_name) FROM pilotskills AS T1 JOIN hangar AS T2 ON T1.plane_name = T2.plane_name WHERE T2.location = 'Chicago' | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}, {'table_name': 'hangar', 'table_schema': [{'col_name': 'plane name'}, {'col_name': 'location'}], 'foreign_key_columns': [... |
What are the planes owned by pilot Smith with age 41? | SELECT plane_name FROM pilotskills WHERE pilot_name = 'Smith' AND age = 41 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Return the names of planes owned by the pilot whose name is Smith and is 41 years old. | SELECT plane_name FROM pilotskills WHERE pilot_name = 'Smith' AND age = 41 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
How many distinct planes are owned across all pilots? | SELECT count(DISTINCT plane_name) FROM pilotskills | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Count the number of different plane names across all pilots. | SELECT count(DISTINCT plane_name) FROM pilotskills | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
How many planes are owned by the pilot whose name is Smith? | SELECT count(plane_name) FROM pilotskills WHERE pilot_name = 'Smith' | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Count the number of planes Smith owns. | SELECT count(plane_name) FROM pilotskills WHERE pilot_name = 'Smith' | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
How many planes are controlled by the pilots whose age is older than 40? | SELECT count(plane_name) FROM pilotskills WHERE age > 40 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Count the number of planes flown by pilots older than 40. | SELECT count(plane_name) FROM pilotskills WHERE age > 40 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Find the names of all pilots with age between 30 and 40 sorted by their ages in ascending order. | SELECT pilot_name FROM pilotskills WHERE age BETWEEN 30 AND 40 ORDER BY age | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What are the names of pilots between the ages of 30 and 40, ordered by age ascending? | SELECT pilot_name FROM pilotskills WHERE age BETWEEN 30 AND 40 ORDER BY age | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
List all pilot names sorted by their ages in the descending order. | SELECT pilot_name FROM pilotskills ORDER BY age DESC | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What are the names of pilots, ordered by age descending? | SELECT pilot_name FROM pilotskills ORDER BY age DESC | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Find all locations of planes sorted by the plane name. | SELECT LOCATION FROM hangar ORDER BY plane_name | pilot_1 | [{'table_name': 'hangar', 'table_schema': [{'col_name': 'plane name'}, {'col_name': 'location'}], 'foreign_key_columns': [], 'primary_keys': ['plane name']}] |
What are the locations of the different planes, ordered by plane name? | SELECT LOCATION FROM hangar ORDER BY plane_name | pilot_1 | [{'table_name': 'hangar', 'table_schema': [{'col_name': 'plane name'}, {'col_name': 'location'}], 'foreign_key_columns': [], 'primary_keys': ['plane name']}] |
List all distinct types of planes owned by all pilots in alphabetic order? | SELECT DISTINCT plane_name FROM pilotskills ORDER BY plane_name | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What are the different plane names, ordered alphabetically? | SELECT DISTINCT plane_name FROM pilotskills ORDER BY plane_name | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
How many pilots who are older than 40 or younger than 30? | SELECT count(pilot_name) FROM pilotskills ORDER BY age > 40 OR age < 30 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Count the number of pilots with age greater than 40 or less than 30. | SELECT count(pilot_name) FROM pilotskills ORDER BY age > 40 OR age < 30 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What are the names and ages of pilots who own plane Piper Cub and are older than 35, or have F-14 Fighter and are younger than 30? | SELECT pilot_name , age FROM pilotskills WHERE plane_name = 'Piper Cub' AND age > 35 UNION SELECT pilot_name , age FROM pilotskills WHERE plane_name = 'F-14 Fighter' AND age < 30 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Return the names and ages of pilors who have flown Piper Cub and are older than 35, or have flown the F-14 Fighter and are younger than 30. | SELECT pilot_name , age FROM pilotskills WHERE plane_name = 'Piper Cub' AND age > 35 UNION SELECT pilot_name , age FROM pilotskills WHERE plane_name = 'F-14 Fighter' AND age < 30 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Find pilots who own plane Piper Cub but not B-52 Bomber. | SELECT pilot_name FROM pilotskills WHERE plane_name = 'Piper Cub' EXCEPT SELECT pilot_name FROM pilotskills WHERE plane_name = 'B-52 Bomber' | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What are the names of pilots who have flown Piper Cub but not the B-52 Bomber? | SELECT pilot_name FROM pilotskills WHERE plane_name = 'Piper Cub' EXCEPT SELECT pilot_name FROM pilotskills WHERE plane_name = 'B-52 Bomber' | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Find pilots who own planes Piper Cub and B-52 Bomber. | SELECT pilot_name FROM pilotskills WHERE plane_name = 'Piper Cub' INTERSECT SELECT pilot_name FROM pilotskills WHERE plane_name = 'B-52 Bomber' | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What are the names of pilots who own both Piper Cub and the B-52 Bomber? | SELECT pilot_name FROM pilotskills WHERE plane_name = 'Piper Cub' INTERSECT SELECT pilot_name FROM pilotskills WHERE plane_name = 'B-52 Bomber' | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What are the average and smallest ages of all pilots? | SELECT avg(age) , min(age) FROM pilotskills | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Return the average and minimum ages across all pilots. | SELECT avg(age) , min(age) FROM pilotskills | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What are the names of pilots who have planes in both Austin and Boston? | SELECT T1.pilot_name FROM pilotskills AS T1 JOIN hangar AS T2 ON T1.plane_name = T2.plane_name WHERE T2.location = "Austin" INTERSECT SELECT T1.pilot_name FROM pilotskills AS T1 JOIN hangar AS T2 ON T1.plane_name = T2.plane_name WHERE T2.LOCATION = "Boston" | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}, {'table_name': 'hangar', 'table_schema': [{'col_name': 'plane name'}, {'col_name': 'location'}], 'foreign_key_columns': [... |
Give the names of pilots who have planes in Austin and Boston. | SELECT T1.pilot_name FROM pilotskills AS T1 JOIN hangar AS T2 ON T1.plane_name = T2.plane_name WHERE T2.location = "Austin" INTERSECT SELECT T1.pilot_name FROM pilotskills AS T1 JOIN hangar AS T2 ON T1.plane_name = T2.plane_name WHERE T2.LOCATION = "Boston" | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}, {'table_name': 'hangar', 'table_schema': [{'col_name': 'plane name'}, {'col_name': 'location'}], 'foreign_key_columns': [... |
Find the pilots who have either plane Piper Cub or plane F-14 Fighter. | SELECT pilot_name FROM pilotskills WHERE plane_name = 'Piper Cub' OR plane_name = 'F-14 Fighter' | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What are the names of pilots who have either the Piper Cub or the F-14 Fighter? | SELECT pilot_name FROM pilotskills WHERE plane_name = 'Piper Cub' OR plane_name = 'F-14 Fighter' | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What is the average age of pilots for different types of planes? | SELECT avg(age) , plane_name FROM pilotskills GROUP BY plane_name | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Return the average age of pilots for each plane name. | SELECT avg(age) , plane_name FROM pilotskills GROUP BY plane_name | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Find the number of planes for each type. | SELECT count(*) , plane_name FROM pilotskills GROUP BY plane_name | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Count the number of entries for each plane name. | SELECT count(*) , plane_name FROM pilotskills GROUP BY plane_name | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Find the name of the oldest pilot for each type of plane, and order the results by plane name. | SELECT pilot_name , plane_name , max(age) FROM pilotskills GROUP BY plane_name ORDER BY plane_name | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What are the different plane names, and what are the names of the oldest pilot who has each, ordered by plane name? | SELECT pilot_name , plane_name , max(age) FROM pilotskills GROUP BY plane_name ORDER BY plane_name | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What are the names of oldest pilots for each type of plane? | SELECT pilot_name , plane_name , max(age) FROM pilotskills GROUP BY plane_name | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Return the names of the different planes, as well as the names of the oldest pilots who flew each. | SELECT pilot_name , plane_name , max(age) FROM pilotskills GROUP BY plane_name | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Find the max age for each group of pilots with the same name. | SELECT max(age) , pilot_name FROM pilotskills GROUP BY pilot_name | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What are the different pilot names, and what are the maximum ages of pilots for each? | SELECT max(age) , pilot_name FROM pilotskills GROUP BY pilot_name | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
For each city, find the number and average age of pilots who have a plane. | SELECT count(T1.pilot_name) , avg(T1.age) , T2.location FROM pilotskills AS T1 JOIN hangar AS T2 ON T1.plane_name = T2.plane_name GROUP BY T2.location | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}, {'table_name': 'hangar', 'table_schema': [{'col_name': 'plane name'}, {'col_name': 'location'}], 'foreign_key_columns': [... |
What are the different hangar locations and how many pilots correspond to each. Also, what are their average ages? | SELECT count(T1.pilot_name) , avg(T1.age) , T2.location FROM pilotskills AS T1 JOIN hangar AS T2 ON T1.plane_name = T2.plane_name GROUP BY T2.location | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}, {'table_name': 'hangar', 'table_schema': [{'col_name': 'plane name'}, {'col_name': 'location'}], 'foreign_key_columns': [... |
Find the number of pilots for the plane types with average pilot age below 35. | SELECT count(*) , plane_name FROM pilotskills GROUP BY plane_name HAVING avg(age) < 35 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What are the different plane names of planes with an average pilot age of below 35, and how many pilots have flown each of them? | SELECT count(*) , plane_name FROM pilotskills GROUP BY plane_name HAVING avg(age) < 35 | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Find the location of the plane that is owned by the youngest pilot. | SELECT T2.location FROM pilotskills AS T1 JOIN hangar AS T2 ON T1.plane_name = T2.plane_name WHERE T1.age = (SELECT min(age) FROM pilotskills) | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}, {'table_name': 'hangar', 'table_schema': [{'col_name': 'plane name'}, {'col_name': 'location'}], 'foreign_key_columns': [... |
What is the location of the plane that was flown by the pilot with the lowest age? | SELECT T2.location FROM pilotskills AS T1 JOIN hangar AS T2 ON T1.plane_name = T2.plane_name WHERE T1.age = (SELECT min(age) FROM pilotskills) | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}, {'table_name': 'hangar', 'table_schema': [{'col_name': 'plane name'}, {'col_name': 'location'}], 'foreign_key_columns': [... |
Find the name and age of pilots who have a plane in Austin. | SELECT T1.pilot_name , T1.age FROM pilotskills AS T1 JOIN hangar AS T2 ON T1.plane_name = T2.plane_name WHERE T2.location = "Austin" | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}, {'table_name': 'hangar', 'table_schema': [{'col_name': 'plane name'}, {'col_name': 'location'}], 'foreign_key_columns': [... |
What are the names and ages of pilots who have planes located in Austin? | SELECT T1.pilot_name , T1.age FROM pilotskills AS T1 JOIN hangar AS T2 ON T1.plane_name = T2.plane_name WHERE T2.location = "Austin" | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}, {'table_name': 'hangar', 'table_schema': [{'col_name': 'plane name'}, {'col_name': 'location'}], 'foreign_key_columns': [... |
List in alphabetic order the names of pilots whose age is greater than some pilots having plane Piper Cub. | SELECT pilot_name FROM pilotskills WHERE age > (SELECT min(age) FROM pilotskills WHERE plane_name = 'Piper Cub') ORDER BY pilot_name | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Return the names of pilots who are older than any pilot who has flown Piper Cub, ordered alphabetically. | SELECT pilot_name FROM pilotskills WHERE age > (SELECT min(age) FROM pilotskills WHERE plane_name = 'Piper Cub') ORDER BY pilot_name | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Find the number of pilots whose age is younger than all pilots whose plane is F-14 Fighter. | SELECT count(*) FROM pilotskills WHERE age < (SELECT min(age) FROM pilotskills WHERE plane_name = 'F-14 Fighter') | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
How many pilots are younger than all pilots who own the F-14 Fighter? | SELECT count(*) FROM pilotskills WHERE age < (SELECT min(age) FROM pilotskills WHERE plane_name = 'F-14 Fighter') | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Find all different planes whose names contain substring 'Bomber'. | SELECT DISTINCT plane_name FROM pilotskills WHERE plane_name LIKE '%Bomber%' | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
What are the different plane names that contain the word Bomber? | SELECT DISTINCT plane_name FROM pilotskills WHERE plane_name LIKE '%Bomber%' | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Find the number of all pilots whose age is older than some pilot who has plane Piper Cub. | SELECT count(pilot_name) FROM pilotskills WHERE age > (SELECT min(age) FROM pilotskills WHERE plane_name = 'Piper Cub') | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
How many pilots are older than the youngest pilot who has Piper Cub? | SELECT count(pilot_name) FROM pilotskills WHERE age > (SELECT min(age) FROM pilotskills WHERE plane_name = 'Piper Cub') | pilot_1 | [{'table_name': 'pilot skills', 'table_schema': [{'col_name': 'pilot name'}, {'col_name': 'plane name'}, {'col_name': 'age'}], 'foreign_key_columns': ['plane name'], 'primary_keys': ['pilot name']}] |
Find the name of the district which has the largest area. | SELECT name FROM district ORDER BY Area_km DESC LIMIT 1 | district_spokesman | [{'table_name': 'district', 'table_schema': [{'col_name': 'district id'}, {'col_name': 'name'}, {'col_name': 'area km'}, {'col_name': 'population'}, {'col_name': 'density km'}, {'col_name': 'government website'}], 'foreign_key_columns': [], 'primary_keys': ['district id']}] |
Select the area and government website of the district with the smallest population. | SELECT area_km , Government_website FROM district ORDER BY Population LIMIT 1 | district_spokesman | [{'table_name': 'district', 'table_schema': [{'col_name': 'district id'}, {'col_name': 'name'}, {'col_name': 'area km'}, {'col_name': 'population'}, {'col_name': 'density km'}, {'col_name': 'government website'}], 'foreign_key_columns': [], 'primary_keys': ['district id']}] |
Find the names and populations of the districts whose area is greater than the average area. | SELECT name , population FROM district WHERE area_km > (SELECT avg(area_km) FROM district) | district_spokesman | [{'table_name': 'district', 'table_schema': [{'col_name': 'district id'}, {'col_name': 'name'}, {'col_name': 'area km'}, {'col_name': 'population'}, {'col_name': 'density km'}, {'col_name': 'government website'}], 'foreign_key_columns': [], 'primary_keys': ['district id']}] |
Give me the biggest and average areas of all districts. | SELECT max(area_km) , avg(area_km) FROM district | district_spokesman | [{'table_name': 'district', 'table_schema': [{'col_name': 'district id'}, {'col_name': 'name'}, {'col_name': 'area km'}, {'col_name': 'population'}, {'col_name': 'density km'}, {'col_name': 'government website'}], 'foreign_key_columns': [], 'primary_keys': ['district id']}] |
What is the total population of the districts whose areas are in the top 3? | SELECT sum(population) FROM district ORDER BY area_km DESC LIMIT 3 | district_spokesman | [{'table_name': 'district', 'table_schema': [{'col_name': 'district id'}, {'col_name': 'name'}, {'col_name': 'area km'}, {'col_name': 'population'}, {'col_name': 'density km'}, {'col_name': 'government website'}], 'foreign_key_columns': [], 'primary_keys': ['district id']}] |
List the ids, names, and government websites of all districts sorted by population. | SELECT name , Government_website , district_id FROM district ORDER BY Population | district_spokesman | [{'table_name': 'district', 'table_schema': [{'col_name': 'district id'}, {'col_name': 'name'}, {'col_name': 'area km'}, {'col_name': 'population'}, {'col_name': 'density km'}, {'col_name': 'government website'}], 'foreign_key_columns': [], 'primary_keys': ['district id']}] |
Find the names of districts whose government links use a 'gov' domain. | SELECT name FROM district WHERE Government_website LIKE "%gov%" | district_spokesman | [{'table_name': 'district', 'table_schema': [{'col_name': 'district id'}, {'col_name': 'name'}, {'col_name': 'area km'}, {'col_name': 'population'}, {'col_name': 'density km'}, {'col_name': 'government website'}], 'foreign_key_columns': [], 'primary_keys': ['district id']}] |
Return the ids and names of the districts whose population is larger than 4000 or area bigger than 3000. | SELECT district_id , name FROM district WHERE area_km > 3000 OR population > 4000 | district_spokesman | [{'table_name': 'district', 'table_schema': [{'col_name': 'district id'}, {'col_name': 'name'}, {'col_name': 'area km'}, {'col_name': 'population'}, {'col_name': 'density km'}, {'col_name': 'government website'}], 'foreign_key_columns': [], 'primary_keys': ['district id']}] |
Find all spokesman's names and speech titles. | SELECT name , speach_title FROM spokesman | district_spokesman | [{'table_name': 'spokesman', 'table_schema': [{'col_name': 'spokesman id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'speach title'}, {'col_name': 'rank position'}, {'col_name': 'points'}], 'foreign_key_columns': [], 'primary_keys': ['spokesman id']}] |
Find the average points and average ages of all spokesmen whose rank position is 1. | SELECT avg(points) , avg(age) FROM spokesman WHERE rank_position = 1 | district_spokesman | [{'table_name': 'spokesman', 'table_schema': [{'col_name': 'spokesman id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'speach title'}, {'col_name': 'rank position'}, {'col_name': 'points'}], 'foreign_key_columns': [], 'primary_keys': ['spokesman id']}] |
What are the names and points of spokesmen who are younger than 40? | SELECT name , points FROM spokesman WHERE age < 40 | district_spokesman | [{'table_name': 'spokesman', 'table_schema': [{'col_name': 'spokesman id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'speach title'}, {'col_name': 'rank position'}, {'col_name': 'points'}], 'foreign_key_columns': [], 'primary_keys': ['spokesman id']}] |
Who is the oldest spokesman? | SELECT name FROM spokesman ORDER BY age DESC LIMIT 1 | district_spokesman | [{'table_name': 'spokesman', 'table_schema': [{'col_name': 'spokesman id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'speach title'}, {'col_name': 'rank position'}, {'col_name': 'points'}], 'foreign_key_columns': [], 'primary_keys': ['spokesman id']}] |
Which spokesman has lower points than the average? | SELECT name FROM spokesman WHERE points < (SELECT avg(points) FROM spokesman) | district_spokesman | [{'table_name': 'spokesman', 'table_schema': [{'col_name': 'spokesman id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'speach title'}, {'col_name': 'rank position'}, {'col_name': 'points'}], 'foreign_key_columns': [], 'primary_keys': ['spokesman id']}] |
Find the name of the district which has greatest number of spokesmen. | SELECT t1.name FROM district AS t1 JOIN spokesman_district AS t2 ON t1.District_ID = t2.District_ID GROUP BY t2.District_ID ORDER BY count(*) DESC LIMIT 1 | district_spokesman | [{'table_name': 'district', 'table_schema': [{'col_name': 'district id'}, {'col_name': 'name'}, {'col_name': 'area km'}, {'col_name': 'population'}, {'col_name': 'density km'}, {'col_name': 'government website'}], 'foreign_key_columns': [], 'primary_keys': ['district id']}, {'table_name': 'spokesman district', 'table_s... |
Find the names of spokesmen who have served some district before 2004. | SELECT t1.name FROM spokesman AS t1 JOIN spokesman_district AS t2 ON t1.Spokesman_ID = t2.Spokesman_ID WHERE t2.start_year < 2004 | district_spokesman | [{'table_name': 'spokesman', 'table_schema': [{'col_name': 'spokesman id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'speach title'}, {'col_name': 'rank position'}, {'col_name': 'points'}], 'foreign_key_columns': [], 'primary_keys': ['spokesman id']}, {'table_name': 'spokesman district', 'table_schema': ... |
Find the number of spokesmen for each district, and the show district names as well. | SELECT t1.name , count(*) FROM district AS t1 JOIN spokesman_district AS t2 ON t1.District_ID = t2.District_ID GROUP BY t2.District_ID | district_spokesman | [{'table_name': 'district', 'table_schema': [{'col_name': 'district id'}, {'col_name': 'name'}, {'col_name': 'area km'}, {'col_name': 'population'}, {'col_name': 'density km'}, {'col_name': 'government website'}], 'foreign_key_columns': [], 'primary_keys': ['district id']}, {'table_name': 'spokesman district', 'table_s... |
Find the names of the districts which have had both spokesman with rank position 1 and 2. | SELECT t3.name FROM spokesman AS t1 JOIN spokesman_district AS t2 ON t1.Spokesman_ID = t2.Spokesman_ID JOIN district AS t3 ON t3.district_id = t2.district_id WHERE t1.rank_position = 1 INTERSECT SELECT t3.name FROM spokesman AS t1 JOIN spokesman_district AS t2 ON t1.Spokesman_ID = t2.Spokesman_ID JOIN district ... | district_spokesman | [{'table_name': 'district', 'table_schema': [{'col_name': 'district id'}, {'col_name': 'name'}, {'col_name': 'area km'}, {'col_name': 'population'}, {'col_name': 'density km'}, {'col_name': 'government website'}], 'foreign_key_columns': [], 'primary_keys': ['district id']}, {'table_name': 'spokesman', 'table_schema': [... |
Find the names of districts which have more than one spokesman. | SELECT t1.name FROM district AS t1 JOIN spokesman_district AS t2 ON t1.District_ID = t2.District_ID GROUP BY t2.District_ID HAVING count(*) > 1 | district_spokesman | [{'table_name': 'district', 'table_schema': [{'col_name': 'district id'}, {'col_name': 'name'}, {'col_name': 'area km'}, {'col_name': 'population'}, {'col_name': 'density km'}, {'col_name': 'government website'}], 'foreign_key_columns': [], 'primary_keys': ['district id']}, {'table_name': 'spokesman district', 'table_s... |
Find the number of districts which have no spokesmen. | SELECT count(*) FROM district WHERE district_id NOT IN (SELECT district_id FROM spokesman_district) | district_spokesman | [{'table_name': 'district', 'table_schema': [{'col_name': 'district id'}, {'col_name': 'name'}, {'col_name': 'area km'}, {'col_name': 'population'}, {'col_name': 'density km'}, {'col_name': 'government website'}], 'foreign_key_columns': [], 'primary_keys': ['district id']}, {'table_name': 'spokesman district', 'table_s... |
Find the name of spokesmen who do not speak for any district. | SELECT name FROM spokesman WHERE Spokesman_ID NOT IN (SELECT Spokesman_ID FROM spokesman_district) | district_spokesman | [{'table_name': 'spokesman', 'table_schema': [{'col_name': 'spokesman id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'speach title'}, {'col_name': 'rank position'}, {'col_name': 'points'}], 'foreign_key_columns': [], 'primary_keys': ['spokesman id']}, {'table_name': 'spokesman district', 'table_schema': ... |
Find the total and average population of the districts which have some spokesman. | SELECT sum(population) , avg(population) FROM district WHERE district_id IN (SELECT district_id FROM spokesman_district) | district_spokesman | [{'table_name': 'district', 'table_schema': [{'col_name': 'district id'}, {'col_name': 'name'}, {'col_name': 'area km'}, {'col_name': 'population'}, {'col_name': 'density km'}, {'col_name': 'government website'}], 'foreign_key_columns': [], 'primary_keys': ['district id']}, {'table_name': 'spokesman district', 'table_s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.