nl
stringlengths
18
174
sql
stringlengths
20
422
db_id
stringclasses
20 values
table_schema
stringclasses
90 values
What is the name of each teacher and what course they teach?
SELECT T3.Name , T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID
course_teach
[{'table_name': 'course', 'table_schema': [{'col_name': 'course id'}, {'col_name': 'staring date'}, {'col_name': 'course'}], 'foreign_key_columns': [], 'primary_keys': ['course id']}, {'table_name': 'teacher', 'table_schema': [{'col_name': 'teacher id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'hometown...
Show names of teachers and the courses they are arranged to teach in ascending alphabetical order of the teacher's name.
SELECT T3.Name , T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID ORDER BY T3.Name
course_teach
[{'table_name': 'course', 'table_schema': [{'col_name': 'course id'}, {'col_name': 'staring date'}, {'col_name': 'course'}], 'foreign_key_columns': [], 'primary_keys': ['course id']}, {'table_name': 'teacher', 'table_schema': [{'col_name': 'teacher id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'hometown...
What are the names of the teachers and the courses they teach in ascending alphabetical order by the name of the teacher?
SELECT T3.Name , T2.Course FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID ORDER BY T3.Name
course_teach
[{'table_name': 'course', 'table_schema': [{'col_name': 'course id'}, {'col_name': 'staring date'}, {'col_name': 'course'}], 'foreign_key_columns': [], 'primary_keys': ['course id']}, {'table_name': 'teacher', 'table_schema': [{'col_name': 'teacher id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'hometown...
Show the name of the teacher for the math course.
SELECT T3.Name FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID WHERE T2.Course = "Math"
course_teach
[{'table_name': 'course', 'table_schema': [{'col_name': 'course id'}, {'col_name': 'staring date'}, {'col_name': 'course'}], 'foreign_key_columns': [], 'primary_keys': ['course id']}, {'table_name': 'teacher', 'table_schema': [{'col_name': 'teacher id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'hometown...
What are the names of the people who teach math courses?
SELECT T3.Name FROM course_arrange AS T1 JOIN course AS T2 ON T1.Course_ID = T2.Course_ID JOIN teacher AS T3 ON T1.Teacher_ID = T3.Teacher_ID WHERE T2.Course = "Math"
course_teach
[{'table_name': 'course', 'table_schema': [{'col_name': 'course id'}, {'col_name': 'staring date'}, {'col_name': 'course'}], 'foreign_key_columns': [], 'primary_keys': ['course id']}, {'table_name': 'teacher', 'table_schema': [{'col_name': 'teacher id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'hometown...
Show names of teachers and the number of courses they teach.
SELECT T2.Name , COUNT(*) FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name
course_teach
[{'table_name': 'teacher', 'table_schema': [{'col_name': 'teacher id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'hometown'}], 'foreign_key_columns': [], 'primary_keys': ['teacher id']}]
What are the names of the teachers and how many courses do they teach?
SELECT T2.Name , COUNT(*) FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name
course_teach
[{'table_name': 'teacher', 'table_schema': [{'col_name': 'teacher id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'hometown'}], 'foreign_key_columns': [], 'primary_keys': ['teacher id']}]
Show names of teachers that teach at least two courses.
SELECT T2.Name FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name HAVING COUNT(*) >= 2
course_teach
[{'table_name': 'teacher', 'table_schema': [{'col_name': 'teacher id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'hometown'}], 'foreign_key_columns': [], 'primary_keys': ['teacher id']}]
What are the names of the teachers who teach at least two courses?
SELECT T2.Name FROM course_arrange AS T1 JOIN teacher AS T2 ON T1.Teacher_ID = T2.Teacher_ID GROUP BY T2.Name HAVING COUNT(*) >= 2
course_teach
[{'table_name': 'teacher', 'table_schema': [{'col_name': 'teacher id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'hometown'}], 'foreign_key_columns': [], 'primary_keys': ['teacher id']}]
List the names of teachers who have not been arranged to teach courses.
SELECT Name FROM teacher WHERE Teacher_id NOT IN (SELECT Teacher_id FROM course_arrange)
course_teach
[{'table_name': 'teacher', 'table_schema': [{'col_name': 'teacher id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'hometown'}], 'foreign_key_columns': [], 'primary_keys': ['teacher id']}]
What are the names of the teachers whose courses have not been arranged?
SELECT Name FROM teacher WHERE Teacher_id NOT IN (SELECT Teacher_id FROM course_arrange)
course_teach
[{'table_name': 'teacher', 'table_schema': [{'col_name': 'teacher id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'hometown'}], 'foreign_key_columns': [], 'primary_keys': ['teacher id']}]
How many visitors below age 30 are there?
SELECT count(*) FROM visitor WHERE age < 30
museum_visit
[]
Find the names of the visitors whose membership level is higher than 4, and order the results by the level from high to low.
SELECT name FROM visitor WHERE Level_of_membership > 4 ORDER BY Level_of_membership DESC
museum_visit
[]
What is the average age of the visitors whose membership level is not higher than 4?
SELECT avg(age) FROM visitor WHERE Level_of_membership <= 4
museum_visit
[]
Find the name and membership level of the visitors whose membership level is higher than 4, and sort by their age from old to young.
SELECT name , Level_of_membership FROM visitor WHERE Level_of_membership > 4 ORDER BY age DESC
museum_visit
[]
Find the id and name of the museum that has the most staff members?
SELECT museum_id , name FROM museum ORDER BY num_of_staff DESC LIMIT 1
museum_visit
[{'table_name': 'museum', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'name'}, {'col_name': 'num of staff'}, {'col_name': 'open year'}], 'foreign_key_columns': [], 'primary_keys': ['museum id']}]
Find the average number of staff working for the museums that were open before 2009.
SELECT avg(num_of_staff) FROM museum WHERE open_year < 2009
museum_visit
[{'table_name': 'museum', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'name'}, {'col_name': 'num of staff'}, {'col_name': 'open year'}], 'foreign_key_columns': [], 'primary_keys': ['museum id']}]
What are the opening year and staff number of the museum named Plaza Museum?
SELECT Num_of_Staff , Open_Year FROM museum WHERE name = 'Plaza Museum'
museum_visit
[{'table_name': 'museum', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'name'}, {'col_name': 'num of staff'}, {'col_name': 'open year'}], 'foreign_key_columns': [], 'primary_keys': ['museum id']}]
find the names of museums which have more staff than the minimum staff number of all museums opened after 2010.
SELECT name FROM museum WHERE num_of_staff > (SELECT min(num_of_staff) FROM museum WHERE open_year > 2010)
museum_visit
[{'table_name': 'museum', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'name'}, {'col_name': 'num of staff'}, {'col_name': 'open year'}], 'foreign_key_columns': [], 'primary_keys': ['museum id']}]
find the id, name and age for visitors who visited some museums more than once.
SELECT t1.id , t1.name , t1.age FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id GROUP BY t1.id HAVING count(*) > 1
museum_visit
[{'table_name': 'visit', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'customer id'}, {'col_name': 'num of ticket'}, {'col_name': 'total spent'}], 'foreign_key_columns': ['customer id', 'museum id'], 'primary_keys': ['museum id']}]
What are the id, name and membership level of visitors who have spent the largest amount of money in total in all museum tickets?
SELECT t2.visitor_id , t1.name , t1.Level_of_membership FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id GROUP BY t2.visitor_id ORDER BY sum(t2.Total_spent) DESC LIMIT 1
museum_visit
[{'table_name': 'visit', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'customer id'}, {'col_name': 'num of ticket'}, {'col_name': 'total spent'}], 'foreign_key_columns': ['customer id', 'museum id'], 'primary_keys': ['museum id']}]
What are the id and name of the museum visited most times?
SELECT t2.Museum_ID , t1.name FROM museum AS t1 JOIN visit AS t2 ON t1.Museum_ID = t2.Museum_ID GROUP BY t2.Museum_ID ORDER BY count(*) DESC LIMIT 1
museum_visit
[{'table_name': 'museum', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'name'}, {'col_name': 'num of staff'}, {'col_name': 'open year'}], 'foreign_key_columns': [], 'primary_keys': ['museum id']}, {'table_name': 'visit', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'customer id'}, {'col_name': '...
What is the name of the museum that had no visitor yet?
SELECT name FROM museum WHERE Museum_ID NOT IN (SELECT museum_id FROM visit)
museum_visit
[{'table_name': 'museum', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'name'}, {'col_name': 'num of staff'}, {'col_name': 'open year'}], 'foreign_key_columns': [], 'primary_keys': ['museum id']}, {'table_name': 'visit', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'customer id'}, {'col_name': '...
Find the name and age of the visitor who bought the most tickets at once.
SELECT t1.name , t1.age FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id ORDER BY t2.num_of_ticket DESC LIMIT 1
museum_visit
[{'table_name': 'visit', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'customer id'}, {'col_name': 'num of ticket'}, {'col_name': 'total spent'}], 'foreign_key_columns': ['customer id', 'museum id'], 'primary_keys': ['museum id']}]
What are the average and maximum number of tickets bought in all visits?
SELECT avg(num_of_ticket) , max(num_of_ticket) FROM visit
museum_visit
[{'table_name': 'visit', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'customer id'}, {'col_name': 'num of ticket'}, {'col_name': 'total spent'}], 'foreign_key_columns': ['customer id', 'museum id'], 'primary_keys': ['museum id']}]
What is the total ticket expense of the visitors whose membership level is 1?
SELECT sum(t2.Total_spent) FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id WHERE t1.Level_of_membership = 1
museum_visit
[{'table_name': 'visit', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'customer id'}, {'col_name': 'num of ticket'}, {'col_name': 'total spent'}], 'foreign_key_columns': ['customer id', 'museum id'], 'primary_keys': ['museum id']}]
What is the name of the visitor who visited both a museum opened before 2009 and a museum opened after 2011?
SELECT t1.name FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id JOIN museum AS t3 ON t3.Museum_ID = t2.Museum_ID WHERE t3.open_year < 2009 INTERSECT SELECT t1.name FROM visitor AS t1 JOIN visit AS t2 ON t1.id = t2.visitor_id JOIN museum AS t3 ON t3.Museum_ID = t2.Museum_ID WHERE t3.open_year > 2...
museum_visit
[{'table_name': 'museum', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'name'}, {'col_name': 'num of staff'}, {'col_name': 'open year'}], 'foreign_key_columns': [], 'primary_keys': ['museum id']}, {'table_name': 'visit', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'customer id'}, {'col_name': '...
Find the number of visitors who did not visit any museum opened after 2010.
SELECT count(*) FROM visitor WHERE id NOT IN (SELECT t2.visitor_id FROM museum AS t1 JOIN visit AS t2 ON t1.Museum_ID = t2.Museum_ID WHERE t1.open_year > 2010)
museum_visit
[{'table_name': 'museum', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'name'}, {'col_name': 'num of staff'}, {'col_name': 'open year'}], 'foreign_key_columns': [], 'primary_keys': ['museum id']}, {'table_name': 'visit', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'customer id'}, {'col_name': '...
How many museums were opened after 2013 or before 2008?
SELECT count(*) FROM museum WHERE open_year > 2013 OR open_year < 2008
museum_visit
[{'table_name': 'museum', 'table_schema': [{'col_name': 'museum id'}, {'col_name': 'name'}, {'col_name': 'num of staff'}, {'col_name': 'open year'}], 'foreign_key_columns': [], 'primary_keys': ['museum id']}]
Find the total number of players.
SELECT count(*) FROM players
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
How many players are there?
SELECT count(*) FROM players
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
Find the total number of matches.
SELECT count(*) FROM matches
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
Count the number of matches.
SELECT count(*) FROM matches
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
List the first name and birth date of all players from the country with code USA.
SELECT first_name , birth_date FROM players WHERE country_code = 'USA'
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
What are the first names and birth dates of players from the USA?
SELECT first_name , birth_date FROM players WHERE country_code = 'USA'
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
Find the average age of losers and winners of all matches.
SELECT avg(loser_age) , avg(winner_age) FROM matches
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
What are the average ages of losers and winners across matches?
SELECT avg(loser_age) , avg(winner_age) FROM matches
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
Find the average rank of winners in all matches.
SELECT avg(winner_rank) FROM matches
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
What is the average rank for winners in all matches?
SELECT avg(winner_rank) FROM matches
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
Find the highest rank of losers in all matches.
SELECT min(loser_rank) FROM matches
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
What is the best rank of losers across all matches?
SELECT min(loser_rank) FROM matches
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
find the number of distinct country codes of all players.
SELECT count(DISTINCT country_code) FROM players
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
How many distinct countries do players come from?
SELECT count(DISTINCT country_code) FROM players
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
Find the number of distinct name of losers.
SELECT count(DISTINCT loser_name) FROM matches
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
How many different loser names are there?
SELECT count(DISTINCT loser_name) FROM matches
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
Find the name of tourney that has more than 10 matches.
SELECT tourney_name FROM matches GROUP BY tourney_name HAVING count(*) > 10
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
What are the names of tournaments that have more than 10 matches?
SELECT tourney_name FROM matches GROUP BY tourney_name HAVING count(*) > 10
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
List the names of all winners who played in both 2013 and 2016.
SELECT winner_name FROM matches WHERE YEAR = 2013 INTERSECT SELECT winner_name FROM matches WHERE YEAR = 2016
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
What are the names of players who won in both 2013 and 2016?
SELECT winner_name FROM matches WHERE YEAR = 2013 INTERSECT SELECT winner_name FROM matches WHERE YEAR = 2016
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
List the number of all matches who played in years of 2013 or 2016.
SELECT count(*) FROM matches WHERE YEAR = 2013 OR YEAR = 2016
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
How many matches were played in 2013 or 2016?
SELECT count(*) FROM matches WHERE YEAR = 2013 OR YEAR = 2016
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
What are the country code and first name of the players who won in both tourney WTA Championships and Australian Open?
SELECT T1.country_code , T1.first_name FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.winner_id WHERE T2.tourney_name = 'WTA Championships' INTERSECT SELECT T1.country_code , T1.first_name FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.winner_id WHERE T2.tourney_name = 'Australian Open...
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}, {'table_name': 'matches', 'table_schema': [{'col_name'...
What are the first names and country codes for players who won both the WTA Championships and the Australian Open?
SELECT T1.country_code , T1.first_name FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.winner_id WHERE T2.tourney_name = 'WTA Championships' INTERSECT SELECT T1.country_code , T1.first_name FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.winner_id WHERE T2.tourney_name = 'Australian Open...
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}, {'table_name': 'matches', 'table_schema': [{'col_name'...
Find the first name and country code of the oldest player.
SELECT first_name , country_code FROM players ORDER BY birth_date LIMIT 1
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
What is the first name and country code of the oldest player?
SELECT first_name , country_code FROM players ORDER BY birth_date LIMIT 1
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
List the first and last name of all players in the order of birth date.
SELECT first_name , last_name FROM players ORDER BY birth_date
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
What are the full names of all players, sorted by birth date?
SELECT first_name , last_name FROM players ORDER BY birth_date
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
List the first and last name of all players who are left / L hand in the order of birth date.
SELECT first_name , last_name FROM players WHERE hand = 'L' ORDER BY birth_date
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
What are the full names of all left handed players, in order of birth date?
SELECT first_name , last_name FROM players WHERE hand = 'L' ORDER BY birth_date
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
Find the first name and country code of the player who did the most number of tours.
SELECT T1.country_code , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id ORDER BY T2.tours DESC LIMIT 1
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}, {'table_name': 'rankings', 'table_schema': [{'col_name...
What is the first name and country code of the player with the most tours?
SELECT T1.country_code , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id ORDER BY T2.tours DESC LIMIT 1
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}, {'table_name': 'rankings', 'table_schema': [{'col_name...
Find the year that has the most number of matches.
SELECT YEAR FROM matches GROUP BY YEAR ORDER BY count(*) DESC LIMIT 1
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
Which year had the most matches?
SELECT YEAR FROM matches GROUP BY YEAR ORDER BY count(*) DESC LIMIT 1
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
Find the name and rank points of the winner who won the most times.
SELECT winner_name , winner_rank_points FROM matches GROUP BY winner_name ORDER BY count(*) DESC LIMIT 1
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
What is the name of the winner who has won the most matches, and how many rank points does this player have?
SELECT winner_name , winner_rank_points FROM matches GROUP BY winner_name ORDER BY count(*) DESC LIMIT 1
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
Find the name of the winner who has the highest rank points and participated in the Australian Open tourney.
SELECT winner_name FROM matches WHERE tourney_name = 'Australian Open' ORDER BY winner_rank_points DESC LIMIT 1
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
What is the name of the winner with the most rank points who participated in the Australian Open tournament?
SELECT winner_name FROM matches WHERE tourney_name = 'Australian Open' ORDER BY winner_rank_points DESC LIMIT 1
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
find the names of loser and winner who played in the match with greatest number of minutes.
SELECT winner_name , loser_name FROM matches ORDER BY minutes DESC LIMIT 1
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
What are the names of the winner and loser who played in the longest match?
SELECT winner_name , loser_name FROM matches ORDER BY minutes DESC LIMIT 1
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
Find the average ranking for each player and their first name.
SELECT avg(ranking) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}, {'table_name': 'rankings', 'table_schema': [{'col_name...
What are the first names of all players, and their average rankings?
SELECT avg(ranking) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}, {'table_name': 'rankings', 'table_schema': [{'col_name...
Find the total ranking points for each player and their first name.
SELECT sum(ranking_points) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}, {'table_name': 'rankings', 'table_schema': [{'col_name...
What are the first names of all players, and their total ranking points?
SELECT sum(ranking_points) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}, {'table_name': 'rankings', 'table_schema': [{'col_name...
find the number of players for each country.
SELECT count(*) , country_code FROM players GROUP BY country_code
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
How many players are from each country?
SELECT count(*) , country_code FROM players GROUP BY country_code
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
find the code of the country where has the greatest number of players.
SELECT country_code FROM players GROUP BY country_code ORDER BY count(*) DESC LIMIT 1
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
What is the code of the country with the most players?
SELECT country_code FROM players GROUP BY country_code ORDER BY count(*) DESC LIMIT 1
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
Find the codes of countries that have more than 50 players.
SELECT country_code FROM players GROUP BY country_code HAVING count(*) > 50
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
What are the codes of countries with more than 50 players?
SELECT country_code FROM players GROUP BY country_code HAVING count(*) > 50
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
Find the total number of tours for each ranking date.
SELECT sum(tours) , ranking_date FROM rankings GROUP BY ranking_date
wta_1
[{'table_name': 'rankings', 'table_schema': [{'col_name': 'ranking date'}, {'col_name': 'ranking'}, {'col_name': 'player id'}, {'col_name': 'ranking points'}, {'col_name': 'tours'}], 'foreign_key_columns': ['player id'], 'primary_keys': []}]
How many total tours were there for each ranking date?
SELECT sum(tours) , ranking_date FROM rankings GROUP BY ranking_date
wta_1
[{'table_name': 'rankings', 'table_schema': [{'col_name': 'ranking date'}, {'col_name': 'ranking'}, {'col_name': 'player id'}, {'col_name': 'ranking points'}, {'col_name': 'tours'}], 'foreign_key_columns': ['player id'], 'primary_keys': []}]
Find the number of matches happened in each year.
SELECT count(*) , YEAR FROM matches GROUP BY YEAR
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
How many matches were played in each year?
SELECT count(*) , YEAR FROM matches GROUP BY YEAR
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
Find the name and rank of the 3 youngest winners across all matches.
SELECT DISTINCT winner_name , winner_rank FROM matches ORDER BY winner_age LIMIT 3
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
What are the names and ranks of the three youngest winners across all matches?
SELECT DISTINCT winner_name , winner_rank FROM matches ORDER BY winner_age LIMIT 3
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
How many different winners both participated in the WTA Championships and were left handed?
SELECT count(DISTINCT winner_name) FROM matches WHERE tourney_name = 'WTA Championships' AND winner_hand = 'L'
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
Find the number of left handed winners who participated in the WTA Championships.
SELECT count(DISTINCT winner_name) FROM matches WHERE tourney_name = 'WTA Championships' AND winner_hand = 'L'
wta_1
[{'table_name': 'matches', 'table_schema': [{'col_name': 'best of'}, {'col_name': 'draw size'}, {'col_name': 'loser age'}, {'col_name': 'loser entry'}, {'col_name': 'loser hand'}, {'col_name': 'loser ht'}, {'col_name': 'loser id'}, {'col_name': 'loser ioc'}, {'col_name': 'loser name'}, {'col_name': 'loser rank'}, {'col...
Find the first name, country code and birth date of the winner who has the highest rank points in all matches.
SELECT T1.first_name , T1.country_code , T1.birth_date FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.winner_id ORDER BY T2.winner_rank_points DESC LIMIT 1
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}, {'table_name': 'matches', 'table_schema': [{'col_name'...
What is the first name, country code, and birth date of the player with the most winner rank points across all matches?
SELECT T1.first_name , T1.country_code , T1.birth_date FROM players AS T1 JOIN matches AS T2 ON T1.player_id = T2.winner_id ORDER BY T2.winner_rank_points DESC LIMIT 1
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}, {'table_name': 'matches', 'table_schema': [{'col_name'...
Find the number of players for each hand type.
SELECT count(*) , hand FROM players GROUP BY hand
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
How many players are there for each hand type?
SELECT count(*) , hand FROM players GROUP BY hand
wta_1
[{'table_name': 'players', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'first name'}, {'col_name': 'last name'}, {'col_name': 'hand'}, {'col_name': 'birth date'}, {'col_name': 'country code'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
How many ships ended up being 'Captured'?
SELECT count(*) FROM ship WHERE disposition_of_ship = 'Captured'
battle_death
[{'table_name': 'ship', 'table_schema': [{'col_name': 'lost in battle'}, {'col_name': 'id'}, {'col_name': 'name'}, {'col_name': 'tonnage'}, {'col_name': 'ship type'}, {'col_name': 'location'}, {'col_name': 'disposition of ship'}], 'foreign_key_columns': ['lost in battle'], 'primary_keys': ['id']}]
List the name and tonnage ordered by in descending alphaetical order for the names.
SELECT name , tonnage FROM ship ORDER BY name DESC
battle_death
[{'table_name': 'ship', 'table_schema': [{'col_name': 'lost in battle'}, {'col_name': 'id'}, {'col_name': 'name'}, {'col_name': 'tonnage'}, {'col_name': 'ship type'}, {'col_name': 'location'}, {'col_name': 'disposition of ship'}], 'foreign_key_columns': ['lost in battle'], 'primary_keys': ['id']}]
List the name, date and result of each battle.
SELECT name , date FROM battle
battle_death
[{'table_name': 'battle', 'table_schema': [{'col_name': 'id'}, {'col_name': 'name'}, {'col_name': 'date'}, {'col_name': 'bulgarian commander'}, {'col_name': 'latin commander'}, {'col_name': 'result'}], 'foreign_key_columns': [], 'primary_keys': ['id']}]
What is maximum and minimum death toll caused each time?
SELECT max(killed) , min(killed) FROM death
battle_death
[{'table_name': 'death', 'table_schema': [{'col_name': 'caused by ship id'}, {'col_name': 'id'}, {'col_name': 'note'}, {'col_name': 'killed'}, {'col_name': 'injured'}], 'foreign_key_columns': ['caused by ship id'], 'primary_keys': ['id']}]
What is the average number of injuries caused each time?
SELECT avg(injured) FROM death
battle_death
[{'table_name': 'death', 'table_schema': [{'col_name': 'caused by ship id'}, {'col_name': 'id'}, {'col_name': 'note'}, {'col_name': 'killed'}, {'col_name': 'injured'}], 'foreign_key_columns': ['caused by ship id'], 'primary_keys': ['id']}]
What are the death and injury situations caused by the ship with tonnage 't'?
SELECT T1.killed , T1.injured FROM death AS T1 JOIN ship AS t2 ON T1.caused_by_ship_id = T2.id WHERE T2.tonnage = 't'
battle_death
[{'table_name': 'ship', 'table_schema': [{'col_name': 'lost in battle'}, {'col_name': 'id'}, {'col_name': 'name'}, {'col_name': 'tonnage'}, {'col_name': 'ship type'}, {'col_name': 'location'}, {'col_name': 'disposition of ship'}], 'foreign_key_columns': ['lost in battle'], 'primary_keys': ['id']}, {'table_name': 'death...
What are the name and results of the battles when the bulgarian commander is not 'Boril'
SELECT name , RESULT FROM battle WHERE bulgarian_commander != 'Boril'
battle_death
[{'table_name': 'battle', 'table_schema': [{'col_name': 'id'}, {'col_name': 'name'}, {'col_name': 'date'}, {'col_name': 'bulgarian commander'}, {'col_name': 'latin commander'}, {'col_name': 'result'}], 'foreign_key_columns': [], 'primary_keys': ['id']}]
What are the different ids and names of the battles that lost any 'Brig' type shipes?
SELECT DISTINCT T1.id , T1.name FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.ship_type = 'Brig'
battle_death
[{'table_name': 'battle', 'table_schema': [{'col_name': 'id'}, {'col_name': 'name'}, {'col_name': 'date'}, {'col_name': 'bulgarian commander'}, {'col_name': 'latin commander'}, {'col_name': 'result'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'ship', 'table_schema': [{'col_name': 'lost in batt...
What are the ids and names of the battles that led to more than 10 people killed in total.
SELECT T1.id , T1.name FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle JOIN death AS T3 ON T2.id = T3.caused_by_ship_id GROUP BY T1.id HAVING sum(T3.killed) > 10
battle_death
[{'table_name': 'battle', 'table_schema': [{'col_name': 'id'}, {'col_name': 'name'}, {'col_name': 'date'}, {'col_name': 'bulgarian commander'}, {'col_name': 'latin commander'}, {'col_name': 'result'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'ship', 'table_schema': [{'col_name': 'lost in batt...