nl
stringlengths
22
185
sql
stringlengths
22
608
db_id
stringclasses
40 values
table_schema
stringclasses
305 values
What are the ids for all shipments on the planet Mars that Turanga Leela manages?
SELECT T1.ShipmentID FROM Shipment AS T1 JOIN Planet AS T2 ON T1.Planet = T2.PlanetID JOIN Employee AS T3 ON T3.EmployeeID = T1.Manager WHERE T2.Name = "Mars" OR T3.Name = "Turanga Leela";
planet_1
[{'table_name': 'employee', 'table_schema': [{'col_name': 'employee id'}, {'col_name': 'name'}, {'col_name': 'position'}, {'col_name': 'salary'}, {'col_name': 'remarks'}], 'foreign_key_columns': [], 'primary_keys': ['employee id']}, {'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name...
What is the total shipments in each planet? List the planet name and total shipments.
SELECT T2.Name , count(*) FROM Shipment AS T1 JOIN Planet AS T2 ON T1.Planet = T2.PlanetID GROUP BY T1.Planet;
planet_1
[{'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name'}, {'col_name': 'coordinates'}], 'foreign_key_columns': [], 'primary_keys': ['planet id']}, {'table_name': 'shipment', 'table_schema': [{'col_name': 'shipment id'}, {'col_name': 'date'}, {'col_name': 'manager'}, {'col_name': 'plane...
How many shipments take place on each planet?
SELECT T2.Name , count(*) FROM Shipment AS T1 JOIN Planet AS T2 ON T1.Planet = T2.PlanetID GROUP BY T1.Planet;
planet_1
[{'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name'}, {'col_name': 'coordinates'}], 'foreign_key_columns': [], 'primary_keys': ['planet id']}, {'table_name': 'shipment', 'table_schema': [{'col_name': 'shipment id'}, {'col_name': 'date'}, {'col_name': 'manager'}, {'col_name': 'plane...
Which planet has most shipments? List the planet name.
SELECT T2.Name FROM Shipment AS T1 JOIN Planet AS T2 ON T1.Planet = T2.PlanetID GROUP BY T1.Planet ORDER BY count(*) DESC LIMIT 1;
planet_1
[{'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name'}, {'col_name': 'coordinates'}], 'foreign_key_columns': [], 'primary_keys': ['planet id']}, {'table_name': 'shipment', 'table_schema': [{'col_name': 'shipment id'}, {'col_name': 'date'}, {'col_name': 'manager'}, {'col_name': 'plane...
What is the name of the planet with the most shipments?
SELECT T2.Name FROM Shipment AS T1 JOIN Planet AS T2 ON T1.Planet = T2.PlanetID GROUP BY T1.Planet ORDER BY count(*) DESC LIMIT 1;
planet_1
[{'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name'}, {'col_name': 'coordinates'}], 'foreign_key_columns': [], 'primary_keys': ['planet id']}, {'table_name': 'shipment', 'table_schema': [{'col_name': 'shipment id'}, {'col_name': 'date'}, {'col_name': 'manager'}, {'col_name': 'plane...
List the manger's name and number of shipments under his management.
SELECT T2.Name , count(*) FROM Shipment AS T1 JOIN Employee AS T2 ON T1.Manager = T2.EmployeeID GROUP BY T1.Manager;
planet_1
[{'table_name': 'employee', 'table_schema': [{'col_name': 'employee id'}, {'col_name': 'name'}, {'col_name': 'position'}, {'col_name': 'salary'}, {'col_name': 'remarks'}], 'foreign_key_columns': [], 'primary_keys': ['employee id']}, {'table_name': 'shipment', 'table_schema': [{'col_name': 'shipment id'}, {'col_name': '...
What are the number of shipments managed and names of each manager?
SELECT T2.Name , count(*) FROM Shipment AS T1 JOIN Employee AS T2 ON T1.Manager = T2.EmployeeID GROUP BY T1.Manager;
planet_1
[{'table_name': 'employee', 'table_schema': [{'col_name': 'employee id'}, {'col_name': 'name'}, {'col_name': 'position'}, {'col_name': 'salary'}, {'col_name': 'remarks'}], 'foreign_key_columns': [], 'primary_keys': ['employee id']}, {'table_name': 'shipment', 'table_schema': [{'col_name': 'shipment id'}, {'col_name': '...
Calculate total weight of package shipped on Mars.
SELECT sum(T1.Weight) FROM PACKAGE AS T1 JOIN Shipment AS T2 ON T1.Shipment = T2.ShipmentID JOIN Planet AS T3 ON T2.Planet = T3.PlanetID WHERE T3.Name = "Mars";
planet_1
[{'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name'}, {'col_name': 'coordinates'}], 'foreign_key_columns': [], 'primary_keys': ['planet id']}, {'table_name': 'shipment', 'table_schema': [{'col_name': 'shipment id'}, {'col_name': 'date'}, {'col_name': 'manager'}, {'col_name': 'plane...
what is the total weight of all packages shipped on Mars?
SELECT sum(T1.Weight) FROM PACKAGE AS T1 JOIN Shipment AS T2 ON T1.Shipment = T2.ShipmentID JOIN Planet AS T3 ON T2.Planet = T3.PlanetID WHERE T3.Name = "Mars";
planet_1
[{'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name'}, {'col_name': 'coordinates'}], 'foreign_key_columns': [], 'primary_keys': ['planet id']}, {'table_name': 'shipment', 'table_schema': [{'col_name': 'shipment id'}, {'col_name': 'date'}, {'col_name': 'manager'}, {'col_name': 'plane...
Calculate total weight of package shipped in each planet . show the name of each planet .
select t3.name , sum(t1.weight) from package as t1 join shipment as t2 on t1.shipment = t2.shipmentid join planet as t3 on t2.planet = t3.planetid group by t2.planet;
planet_1
[{'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name'}, {'col_name': 'coordinates'}], 'foreign_key_columns': [], 'primary_keys': ['planet id']}, {'table_name': 'shipment', 'table_schema': [{'col_name': 'shipment id'}, {'col_name': 'date'}, {'col_name': 'manager'}, {'col_name': 'plane...
what is the total package weight for each planet, list its name ?
select t3.name , sum(t1.weight) from package as t1 join shipment as t2 on t1.shipment = t2.shipmentid join planet as t3 on t2.planet = t3.planetid group by t2.planet;
planet_1
[{'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name'}, {'col_name': 'coordinates'}], 'foreign_key_columns': [], 'primary_keys': ['planet id']}, {'table_name': 'shipment', 'table_schema': [{'col_name': 'shipment id'}, {'col_name': 'date'}, {'col_name': 'manager'}, {'col_name': 'plane...
Which planet has total weight of shipment greater than 30? List planet name.
SELECT T3.Name FROM PACKAGE AS T1 JOIN Shipment AS T2 ON T1.Shipment = T2.ShipmentID JOIN Planet AS T3 ON T2.Planet = T3.PlanetID GROUP BY T2.Planet HAVING sum(T1.Weight) > 30;
planet_1
[{'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name'}, {'col_name': 'coordinates'}], 'foreign_key_columns': [], 'primary_keys': ['planet id']}, {'table_name': 'shipment', 'table_schema': [{'col_name': 'shipment id'}, {'col_name': 'date'}, {'col_name': 'manager'}, {'col_name': 'plane...
What are the names of all planets tjat have a total shipment weight greater than 30?
SELECT T3.Name FROM PACKAGE AS T1 JOIN Shipment AS T2 ON T1.Shipment = T2.ShipmentID JOIN Planet AS T3 ON T2.Planet = T3.PlanetID GROUP BY T2.Planet HAVING sum(T1.Weight) > 30;
planet_1
[{'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name'}, {'col_name': 'coordinates'}], 'foreign_key_columns': [], 'primary_keys': ['planet id']}, {'table_name': 'shipment', 'table_schema': [{'col_name': 'shipment id'}, {'col_name': 'date'}, {'col_name': 'manager'}, {'col_name': 'plane...
List package number of package shipped in planet Omicron Persei 8 and sent by Zapp Brannigan.
SELECT T1.PackageNumber FROM PACKAGE AS T1 JOIN Client AS T2 ON T1.Sender = T2.AccountNumber JOIN Shipment AS T3 ON T1.Shipment = T3.ShipmentID JOIN Planet AS T4 ON T3.Planet = T4.PlanetID WHERE T2.Name = "Zapp Brannigan" AND T4.Name = "Omicron Persei 8";
planet_1
[{'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name'}, {'col_name': 'coordinates'}], 'foreign_key_columns': [], 'primary_keys': ['planet id']}, {'table_name': 'shipment', 'table_schema': [{'col_name': 'shipment id'}, {'col_name': 'date'}, {'col_name': 'manager'}, {'col_name': 'plane...
What are the number of packages sent by Zapp Brannigan and shipped on the Omicron Persei 8?
SELECT T1.PackageNumber FROM PACKAGE AS T1 JOIN Client AS T2 ON T1.Sender = T2.AccountNumber JOIN Shipment AS T3 ON T1.Shipment = T3.ShipmentID JOIN Planet AS T4 ON T3.Planet = T4.PlanetID WHERE T2.Name = "Zapp Brannigan" AND T4.Name = "Omicron Persei 8";
planet_1
[{'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name'}, {'col_name': 'coordinates'}], 'foreign_key_columns': [], 'primary_keys': ['planet id']}, {'table_name': 'shipment', 'table_schema': [{'col_name': 'shipment id'}, {'col_name': 'date'}, {'col_name': 'manager'}, {'col_name': 'plane...
List package number of packages shipped in Omicron Persei 8 planet or sent by Zapp Brannigan.
SELECT T1.PackageNumber FROM PACKAGE AS T1 JOIN Client AS T2 ON T1.Sender = T2.AccountNumber JOIN Shipment AS T3 ON T1.Shipment = T3.ShipmentID JOIN Planet AS T4 ON T3.Planet = T4.PlanetID WHERE T2.Name = "Zapp Brannigan" OR T4.Name = "Omicron Persei 8";
planet_1
[{'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name'}, {'col_name': 'coordinates'}], 'foreign_key_columns': [], 'primary_keys': ['planet id']}, {'table_name': 'shipment', 'table_schema': [{'col_name': 'shipment id'}, {'col_name': 'date'}, {'col_name': 'manager'}, {'col_name': 'plane...
What are the number of packages shipped on Omicron Persei 8 planet or sent by Zapp Brannigan?
SELECT T1.PackageNumber FROM PACKAGE AS T1 JOIN Client AS T2 ON T1.Sender = T2.AccountNumber JOIN Shipment AS T3 ON T1.Shipment = T3.ShipmentID JOIN Planet AS T4 ON T3.Planet = T4.PlanetID WHERE T2.Name = "Zapp Brannigan" OR T4.Name = "Omicron Persei 8";
planet_1
[{'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name'}, {'col_name': 'coordinates'}], 'foreign_key_columns': [], 'primary_keys': ['planet id']}, {'table_name': 'shipment', 'table_schema': [{'col_name': 'shipment id'}, {'col_name': 'date'}, {'col_name': 'manager'}, {'col_name': 'plane...
Which packages have weight between 10 and 30? List the package number and weight.
SELECT PackageNumber , Weight FROM PACKAGE WHERE Weight BETWEEN 10 AND 30;
planet_1
[{'table_name': 'package', 'table_schema': [{'col_name': 'shipment'}, {'col_name': 'package number'}, {'col_name': 'contents'}, {'col_name': 'weight'}, {'col_name': 'sender'}, {'col_name': 'recipient'}], 'foreign_key_columns': ['recipient', 'sender', 'shipment'], 'primary_keys': ['shipment']}]
What are the package numbers and weights that are between 10 and 30?
SELECT PackageNumber , Weight FROM PACKAGE WHERE Weight BETWEEN 10 AND 30;
planet_1
[{'table_name': 'package', 'table_schema': [{'col_name': 'shipment'}, {'col_name': 'package number'}, {'col_name': 'contents'}, {'col_name': 'weight'}, {'col_name': 'sender'}, {'col_name': 'recipient'}], 'foreign_key_columns': ['recipient', 'sender', 'shipment'], 'primary_keys': ['shipment']}]
Which employees do not have clearance in Mars? List employee's name.
SELECT Name FROM Employee EXCEPT SELECT T2.Name FROM Has_Clearance AS T1 JOIN Employee AS T2 ON T1.Employee = T2.EmployeeID JOIN Planet AS T3 ON T1.Planet = T3.PlanetID WHERE T3.Name = "Mars";
planet_1
[{'table_name': 'employee', 'table_schema': [{'col_name': 'employee id'}, {'col_name': 'name'}, {'col_name': 'position'}, {'col_name': 'salary'}, {'col_name': 'remarks'}], 'foreign_key_columns': [], 'primary_keys': ['employee id']}, {'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name...
What are the names of all employees who don't have clearance on Mars?
SELECT Name FROM Employee EXCEPT SELECT T2.Name FROM Has_Clearance AS T1 JOIN Employee AS T2 ON T1.Employee = T2.EmployeeID JOIN Planet AS T3 ON T1.Planet = T3.PlanetID WHERE T3.Name = "Mars";
planet_1
[{'table_name': 'employee', 'table_schema': [{'col_name': 'employee id'}, {'col_name': 'name'}, {'col_name': 'position'}, {'col_name': 'salary'}, {'col_name': 'remarks'}], 'foreign_key_columns': [], 'primary_keys': ['employee id']}, {'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name...
Which employees have clearance in Omega III? List employees' name.
SELECT T2.Name FROM Has_Clearance AS T1 JOIN Employee AS T2 ON T1.Employee = T2.EmployeeID JOIN Planet AS T3 ON T1.Planet = T3.PlanetID WHERE T3.Name = "Omega III";
planet_1
[{'table_name': 'employee', 'table_schema': [{'col_name': 'employee id'}, {'col_name': 'name'}, {'col_name': 'position'}, {'col_name': 'salary'}, {'col_name': 'remarks'}], 'foreign_key_columns': [], 'primary_keys': ['employee id']}, {'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name...
What are the names of all employees with clearance on Omega III?
SELECT T2.Name FROM Has_Clearance AS T1 JOIN Employee AS T2 ON T1.Employee = T2.EmployeeID JOIN Planet AS T3 ON T1.Planet = T3.PlanetID WHERE T3.Name = "Omega III";
planet_1
[{'table_name': 'employee', 'table_schema': [{'col_name': 'employee id'}, {'col_name': 'name'}, {'col_name': 'position'}, {'col_name': 'salary'}, {'col_name': 'remarks'}], 'foreign_key_columns': [], 'primary_keys': ['employee id']}, {'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name...
Which planets that have exact one employee has clearance? List planets' name.
SELECT T3.Name FROM Has_Clearance AS T1 JOIN Employee AS T2 ON T1.Employee = T2.EmployeeID JOIN Planet AS T3 ON T1.Planet = T3.PlanetID GROUP BY T1.Planet HAVING count(*) = 1;
planet_1
[{'table_name': 'employee', 'table_schema': [{'col_name': 'employee id'}, {'col_name': 'name'}, {'col_name': 'position'}, {'col_name': 'salary'}, {'col_name': 'remarks'}], 'foreign_key_columns': [], 'primary_keys': ['employee id']}, {'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name...
What are the names of all planets with one employee that has clearance?
SELECT T3.Name FROM Has_Clearance AS T1 JOIN Employee AS T2 ON T1.Employee = T2.EmployeeID JOIN Planet AS T3 ON T1.Planet = T3.PlanetID GROUP BY T1.Planet HAVING count(*) = 1;
planet_1
[{'table_name': 'employee', 'table_schema': [{'col_name': 'employee id'}, {'col_name': 'name'}, {'col_name': 'position'}, {'col_name': 'salary'}, {'col_name': 'remarks'}], 'foreign_key_columns': [], 'primary_keys': ['employee id']}, {'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name...
Which employees have salaries between 5000 and 10000? List employees' name.
SELECT Name FROM Employee WHERE Salary BETWEEN 5000 AND 10000
planet_1
[{'table_name': 'employee', 'table_schema': [{'col_name': 'employee id'}, {'col_name': 'name'}, {'col_name': 'position'}, {'col_name': 'salary'}, {'col_name': 'remarks'}], 'foreign_key_columns': [], 'primary_keys': ['employee id']}]
What are the employees's names for those that have salaries between 5000 and 10000?
SELECT Name FROM Employee WHERE Salary BETWEEN 5000 AND 10000
planet_1
[{'table_name': 'employee', 'table_schema': [{'col_name': 'employee id'}, {'col_name': 'name'}, {'col_name': 'position'}, {'col_name': 'salary'}, {'col_name': 'remarks'}], 'foreign_key_columns': [], 'primary_keys': ['employee id']}]
Find the name of employees whose salary is above the average salary or more than 5000.
SELECT Name FROM Employee WHERE Salary > 5000 OR Salary > (SELECT avg(salary) FROM employee)
planet_1
[{'table_name': 'employee', 'table_schema': [{'col_name': 'employee id'}, {'col_name': 'name'}, {'col_name': 'position'}, {'col_name': 'salary'}, {'col_name': 'remarks'}], 'foreign_key_columns': [], 'primary_keys': ['employee id']}]
What are the names of all employees who have a salary greater than average or more than 5000?
SELECT Name FROM Employee WHERE Salary > 5000 OR Salary > (SELECT avg(salary) FROM employee)
planet_1
[{'table_name': 'employee', 'table_schema': [{'col_name': 'employee id'}, {'col_name': 'name'}, {'col_name': 'position'}, {'col_name': 'salary'}, {'col_name': 'remarks'}], 'foreign_key_columns': [], 'primary_keys': ['employee id']}]
Find the number of employees who do not have clearance in Mars .
select count(*) from employee where employeeid not in ( select t2.employeeid from has_clearance as t1 join employee as t2 on t1.employee = t2.employeeid join planet as t3 on t1.planet = t3.planetid where t3.name = "mars" );
planet_1
[{'table_name': 'employee', 'table_schema': [{'col_name': 'employee id'}, {'col_name': 'name'}, {'col_name': 'position'}, {'col_name': 'salary'}, {'col_name': 'remarks'}], 'foreign_key_columns': [], 'primary_keys': ['employee id']}, {'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name...
What is the number of employees that do not have clearance on Mars ?
select count(*) from employee where employeeid not in ( select t2.employeeid from has_clearance as t1 join employee as t2 on t1.employee = t2.employeeid join planet as t3 on t1.planet = t3.planetid where t3.name = "mars" );
planet_1
[{'table_name': 'employee', 'table_schema': [{'col_name': 'employee id'}, {'col_name': 'name'}, {'col_name': 'position'}, {'col_name': 'salary'}, {'col_name': 'remarks'}], 'foreign_key_columns': [], 'primary_keys': ['employee id']}, {'table_name': 'planet', 'table_schema': [{'col_name': 'planet id'}, {'col_name': 'name...
How many games are there?
SELECT count(*) FROM game
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}]
Count the number of games.
SELECT count(*) FROM game
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}]
List the Title and Developers of all games ordered by units sold from large to small.
SELECT Title , Developers FROM game ORDER BY Units_sold_Millions DESC
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}]
What are the titles and developers of all games, sorted by units sold descending?
SELECT Title , Developers FROM game ORDER BY Units_sold_Millions DESC
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}]
What is the average units sold in millions of the games that are not developed by Nintendo?
SELECT avg(Units_sold_Millions) FROM game WHERE developers != 'Nintendo'
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}]
Return the average number of units sold in millions for games not developed by Nintendo.
SELECT avg(Units_sold_Millions) FROM game WHERE developers != 'Nintendo'
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}]
What are the names and market districts of all platforms?
SELECT Platform_name , Market_district FROM platform
video_game
[{'table_name': 'platform', 'table_schema': [{'col_name': 'platform id'}, {'col_name': 'platform name'}, {'col_name': 'market district'}, {'col_name': 'download rank'}], 'foreign_key_columns': [], 'primary_keys': ['platform id']}]
Return all platform names and corresponding market districts.
SELECT Platform_name , Market_district FROM platform
video_game
[{'table_name': 'platform', 'table_schema': [{'col_name': 'platform id'}, {'col_name': 'platform name'}, {'col_name': 'market district'}, {'col_name': 'download rank'}], 'foreign_key_columns': [], 'primary_keys': ['platform id']}]
What are the names and id of platforms whose download rank is 1?
SELECT Platform_name , Platform_ID FROM platform WHERE Download_rank = 1
video_game
[{'table_name': 'platform', 'table_schema': [{'col_name': 'platform id'}, {'col_name': 'platform name'}, {'col_name': 'market district'}, {'col_name': 'download rank'}], 'foreign_key_columns': [], 'primary_keys': ['platform id']}]
Return the names and ids of all platforms with the download rank of 1.
SELECT Platform_name , Platform_ID FROM platform WHERE Download_rank = 1
video_game
[{'table_name': 'platform', 'table_schema': [{'col_name': 'platform id'}, {'col_name': 'platform name'}, {'col_name': 'market district'}, {'col_name': 'download rank'}], 'foreign_key_columns': [], 'primary_keys': ['platform id']}]
What are the maximum and minimum rank of the year of players.
SELECT max(Rank_of_the_year) , min(Rank_of_the_year) FROM player
video_game
[{'table_name': 'player', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'rank of the year'}, {'col_name': 'player name'}, {'col_name': 'position'}, {'col_name': 'college'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
Give the maximum and minimum rank of the year across all players.
SELECT max(Rank_of_the_year) , min(Rank_of_the_year) FROM player
video_game
[{'table_name': 'player', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'rank of the year'}, {'col_name': 'player name'}, {'col_name': 'position'}, {'col_name': 'college'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
How many players have rank of the year smaller than 3?
SELECT count(*) FROM player WHERE Rank_of_the_year <= 3
video_game
[{'table_name': 'player', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'rank of the year'}, {'col_name': 'player name'}, {'col_name': 'position'}, {'col_name': 'college'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
Count the number of players that have a rank of year of at most 3.
SELECT count(*) FROM player WHERE Rank_of_the_year <= 3
video_game
[{'table_name': 'player', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'rank of the year'}, {'col_name': 'player name'}, {'col_name': 'position'}, {'col_name': 'college'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
List all player names in ascending alphabetical order.
SELECT Player_name FROM player ORDER BY Player_name ASC
video_game
[{'table_name': 'player', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'rank of the year'}, {'col_name': 'player name'}, {'col_name': 'position'}, {'col_name': 'college'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
What are the names of all players in alphabetical order?
SELECT Player_name FROM player ORDER BY Player_name ASC
video_game
[{'table_name': 'player', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'rank of the year'}, {'col_name': 'player name'}, {'col_name': 'position'}, {'col_name': 'college'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
List names and colleges of all players in descending order of rank of the year.
SELECT Player_name , College FROM player ORDER BY Rank_of_the_year DESC
video_game
[{'table_name': 'player', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'rank of the year'}, {'col_name': 'player name'}, {'col_name': 'position'}, {'col_name': 'college'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
What are the names and colleges of all players, ordered by rank of year descending?
SELECT Player_name , College FROM player ORDER BY Rank_of_the_year DESC
video_game
[{'table_name': 'player', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'rank of the year'}, {'col_name': 'player name'}, {'col_name': 'position'}, {'col_name': 'college'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}]
Please show the names and rank of players that have played the game titled "Super Mario World".
SELECT T3.Player_name , T3.rank_of_the_year FROM game AS T1 JOIN game_player AS T2 ON T1.Game_ID = T2.Game_ID JOIN player AS T3 ON T2.Player_ID = T3.Player_ID WHERE T1.Title = "Super Mario World"
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}, {'table_n...
What are the names and ranks of players who have played the game with the title "Super Mario World"?
SELECT T3.Player_name , T3.rank_of_the_year FROM game AS T1 JOIN game_player AS T2 ON T1.Game_ID = T2.Game_ID JOIN player AS T3 ON T2.Player_ID = T3.Player_ID WHERE T1.Title = "Super Mario World"
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}, {'table_n...
Show the distinct developer of games played by players that go to college "Auburn".
SELECT DISTINCT T1.Developers FROM game AS T1 JOIN game_player AS T2 ON T1.Game_ID = T2.Game_ID JOIN player AS T3 ON T2.Player_ID = T3.Player_ID WHERE T3.College = "Auburn"
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}, {'table_n...
What are the different developers of games that are played by players that attend Auburn college?
SELECT DISTINCT T1.Developers FROM game AS T1 JOIN game_player AS T2 ON T1.Game_ID = T2.Game_ID JOIN player AS T3 ON T2.Player_ID = T3.Player_ID WHERE T3.College = "Auburn"
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}, {'table_n...
What is the average number of units sold in millions of games played by players with position "Guard"?
SELECT avg(Units_sold_Millions) FROM game AS T1 JOIN game_player AS T2 ON T1.Game_ID = T2.Game_ID JOIN player AS T3 ON T2.Player_ID = T3.Player_ID WHERE T3.Position = "Guard"
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}, {'table_n...
Return the average number of units sold in millions among games played by players who have the position Guard.
SELECT avg(Units_sold_Millions) FROM game AS T1 JOIN game_player AS T2 ON T1.Game_ID = T2.Game_ID JOIN player AS T3 ON T2.Player_ID = T3.Player_ID WHERE T3.Position = "Guard"
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}, {'table_n...
Please list the title and platform name of games.
SELECT T1.Title , T2.Platform_name FROM game AS T1 JOIN platform AS T2 ON T1.Platform_ID = T2.Platform_ID
video_game
[{'table_name': 'platform', 'table_schema': [{'col_name': 'platform id'}, {'col_name': 'platform name'}, {'col_name': 'market district'}, {'col_name': 'download rank'}], 'foreign_key_columns': [], 'primary_keys': ['platform id']}, {'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {...
What are the titles and platform names of all games?
SELECT T1.Title , T2.Platform_name FROM game AS T1 JOIN platform AS T2 ON T1.Platform_ID = T2.Platform_ID
video_game
[{'table_name': 'platform', 'table_schema': [{'col_name': 'platform id'}, {'col_name': 'platform name'}, {'col_name': 'market district'}, {'col_name': 'download rank'}], 'foreign_key_columns': [], 'primary_keys': ['platform id']}, {'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {...
Please list the title of games with platforms that have market district in Asia or USA.
SELECT T1.Title FROM game AS T1 JOIN platform AS T2 ON T1.Platform_ID = T2.Platform_ID WHERE T2.Market_district = "Asia" OR T2.Market_district = "USA"
video_game
[{'table_name': 'platform', 'table_schema': [{'col_name': 'platform id'}, {'col_name': 'platform name'}, {'col_name': 'market district'}, {'col_name': 'download rank'}], 'foreign_key_columns': [], 'primary_keys': ['platform id']}, {'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {...
What are the titles of games that have platforms in the market districts of Asia or the USA?
SELECT T1.Title FROM game AS T1 JOIN platform AS T2 ON T1.Platform_ID = T2.Platform_ID WHERE T2.Market_district = "Asia" OR T2.Market_district = "USA"
video_game
[{'table_name': 'platform', 'table_schema': [{'col_name': 'platform id'}, {'col_name': 'platform name'}, {'col_name': 'market district'}, {'col_name': 'download rank'}], 'foreign_key_columns': [], 'primary_keys': ['platform id']}, {'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {...
List the name of each franchise and the number of games belonging to that franchise.
SELECT Franchise , COUNT(*) FROM game GROUP BY Franchise
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}]
How many games are there from each Franchise?
SELECT Franchise , COUNT(*) FROM game GROUP BY Franchise
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}]
List the name of franchise that have the most number of games.
SELECT Franchise FROM game GROUP BY Franchise ORDER BY COUNT(*) DESC LIMIT 1
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}]
Which franchise has the most games?
SELECT Franchise FROM game GROUP BY Franchise ORDER BY COUNT(*) DESC LIMIT 1
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}]
List the names of franchises that have at least two games.
SELECT Franchise FROM game GROUP BY Franchise HAVING COUNT(*) >= 2
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}]
What are the names of franchises that have two or more games?
SELECT Franchise FROM game GROUP BY Franchise HAVING COUNT(*) >= 2
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}]
List the name of players that do not play any game.
SELECT Player_name FROM player WHERE Player_ID NOT IN (SELECT Player_ID FROM game_player)
video_game
[{'table_name': 'player', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'rank of the year'}, {'col_name': 'player name'}, {'col_name': 'position'}, {'col_name': 'college'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}, {'table_name': 'game player', 'table_schema': [{'col_name': 'player id'}, {'...
What are the names of players who do not play any games?
SELECT Player_name FROM player WHERE Player_ID NOT IN (SELECT Player_ID FROM game_player)
video_game
[{'table_name': 'player', 'table_schema': [{'col_name': 'player id'}, {'col_name': 'rank of the year'}, {'col_name': 'player name'}, {'col_name': 'position'}, {'col_name': 'college'}], 'foreign_key_columns': [], 'primary_keys': ['player id']}, {'table_name': 'game player', 'table_schema': [{'col_name': 'player id'}, {'...
Show the title of games that are played by both players from college "Oklahoma" and players from college "Auburn".
SELECT T1.Title FROM game AS T1 JOIN game_player AS T2 ON T1.Game_ID = T2.Game_ID JOIN player AS T3 ON T2.Player_ID = T3.Player_ID WHERE T3.College = "Oklahoma" INTERSECT SELECT T1.Title FROM game AS T1 JOIN game_player AS T2 ON T1.Game_ID = T2.Game_ID JOIN player AS T3 ON T2.Player_ID = T3.Player_ID WHERE T3...
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}, {'table_n...
What are the titles of games that are played by players from Oklahoma college or Auburn college?
SELECT T1.Title FROM game AS T1 JOIN game_player AS T2 ON T1.Game_ID = T2.Game_ID JOIN player AS T3 ON T2.Player_ID = T3.Player_ID WHERE T3.College = "Oklahoma" INTERSECT SELECT T1.Title FROM game AS T1 JOIN game_player AS T2 ON T1.Game_ID = T2.Game_ID JOIN player AS T3 ON T2.Player_ID = T3.Player_ID WHERE T3...
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}, {'table_n...
Show all distinct franchises of games.
SELECT DISTINCT Franchise FROM game
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}]
What are all the distinct franchises?
SELECT DISTINCT Franchise FROM game
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}]
Show the title of games that are not played by any player who is in the Guard position.
SELECT Title FROM game EXCEPT SELECT T1.Title FROM game AS T1 JOIN game_player AS T2 ON T1.Game_ID = T2.Game_ID JOIN player AS T3 ON T2.Player_ID = T3.Player_ID WHERE T3.Position = "Guard"
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}, {'table_n...
What are the titles of games not played by any players who play the Guard position?
SELECT Title FROM game EXCEPT SELECT T1.Title FROM game AS T1 JOIN game_player AS T2 ON T1.Game_ID = T2.Game_ID JOIN player AS T3 ON T2.Player_ID = T3.Player_ID WHERE T3.Position = "Guard"
video_game
[{'table_name': 'game', 'table_schema': [{'col_name': 'game id'}, {'col_name': 'title'}, {'col_name': 'release date'}, {'col_name': 'franchise'}, {'col_name': 'developers'}, {'col_name': 'platform id'}, {'col_name': 'units sold millions'}], 'foreign_key_columns': ['platform id'], 'primary_keys': ['game id']}, {'table_n...
list all the names of press in descending order of the profit of the year.
SELECT name FROM press ORDER BY Year_Profits_billion DESC
book_press
[{'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billion'}, {'col_name': 'year profits billion'}], 'foreign_key_columns': [], 'primary_keys': ['press id']}]
Sorted all the press by year profits in descending order, and return press names.
SELECT name FROM press ORDER BY Year_Profits_billion DESC
book_press
[{'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billion'}, {'col_name': 'year profits billion'}], 'foreign_key_columns': [], 'primary_keys': ['press id']}]
What are the names of the publishers that made more than 15 billion profits each year or 1 billion each month?
SELECT name FROM press WHERE Year_Profits_billion > 15 OR Month_Profits_billion > 1
book_press
[{'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billion'}, {'col_name': 'year profits billion'}], 'foreign_key_columns': [], 'primary_keys': ['press id']}]
Find the press whose yearly profit is more than 15 billion or whose monthly profit is more than 1 billion. Return the press names.
SELECT name FROM press WHERE Year_Profits_billion > 15 OR Month_Profits_billion > 1
book_press
[{'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billion'}, {'col_name': 'year profits billion'}], 'foreign_key_columns': [], 'primary_keys': ['press id']}]
what are the average and maximum profit of a year for all presses?
SELECT avg(Year_Profits_billion) , max(Year_Profits_billion) FROM press
book_press
[{'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billion'}, {'col_name': 'year profits billion'}], 'foreign_key_columns': [], 'primary_keys': ['press id']}]
Find the average and maximum yearly profit for each press.
SELECT avg(Year_Profits_billion) , max(Year_Profits_billion) FROM press
book_press
[{'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billion'}, {'col_name': 'year profits billion'}], 'foreign_key_columns': [], 'primary_keys': ['press id']}]
Find the name of the publisher whose monthly profit is the highest.
SELECT name FROM press ORDER BY Month_Profits_billion DESC LIMIT 1
book_press
[{'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billion'}, {'col_name': 'year profits billion'}], 'foreign_key_columns': [], 'primary_keys': ['press id']}]
Which press has the largest monthly profit? Give me the press name.
SELECT name FROM press ORDER BY Month_Profits_billion DESC LIMIT 1
book_press
[{'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billion'}, {'col_name': 'year profits billion'}], 'foreign_key_columns': [], 'primary_keys': ['press id']}]
Find the name of the publisher whose monthly profit is the highest or the lowest.
SELECT name FROM press WHERE Month_Profits_billion = (SELECT min(Month_Profits_billion) FROM press) OR Month_Profits_billion = (SELECT max(Month_Profits_billion) FROM press)
book_press
[{'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billion'}, {'col_name': 'year profits billion'}], 'foreign_key_columns': [], 'primary_keys': ['press id']}]
What are the names of the press that makes the highest monthly profit or the lowest monthly profit?
SELECT name FROM press WHERE Month_Profits_billion = (SELECT min(Month_Profits_billion) FROM press) OR Month_Profits_billion = (SELECT max(Month_Profits_billion) FROM press)
book_press
[{'table_name': 'press', 'table_schema': [{'col_name': 'press id'}, {'col_name': 'name'}, {'col_name': 'month profits billion'}, {'col_name': 'year profits billion'}], 'foreign_key_columns': [], 'primary_keys': ['press id']}]
how many authors are under age 30?
SELECT count(*) FROM author WHERE age < 30
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}]
Count the number of authors of age below 30.
SELECT count(*) FROM author WHERE age < 30
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}]
find the average age of authors for each gender.
SELECT avg(age) , gender FROM author GROUP BY gender
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}]
For each gender, return gender and the average age of authors.
SELECT avg(age) , gender FROM author GROUP BY gender
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}]
find the number of authors who are older than 30 for each gender.
SELECT count(*) , gender FROM author WHERE age > 30 GROUP BY gender
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}]
How many authors are of age above 30 for each gender?
SELECT count(*) , gender FROM author WHERE age > 30 GROUP BY gender
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}]
List all book titles in the order of their release date from the most recent to the past.
SELECT title FROM book ORDER BY release_date DESC
book_press
[{'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_name': 'author id'}, {'col_name': 'press id'}, {'col_name': 'sale amount'}, {'col_name': 'release date'}], 'foreign_key_columns': ['press id', 'author id'], 'primary_keys': ['book id']}]
Sort all the books in descending order of release date, and return the book titles.
SELECT title FROM book ORDER BY release_date DESC
book_press
[{'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_name': 'author id'}, {'col_name': 'press id'}, {'col_name': 'sale amount'}, {'col_name': 'release date'}], 'foreign_key_columns': ['press id', 'author id'], 'primary_keys': ['book id']}]
Find the number of books for each series.
SELECT count(*) , book_series FROM book GROUP BY book_series
book_press
[{'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_name': 'author id'}, {'col_name': 'press id'}, {'col_name': 'sale amount'}, {'col_name': 'release date'}], 'foreign_key_columns': ['press id', 'author id'], 'primary_keys': ['book id']}]
How many books does each book series have? Return the counts and book series.
SELECT count(*) , book_series FROM book GROUP BY book_series
book_press
[{'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_name': 'author id'}, {'col_name': 'press id'}, {'col_name': 'sale amount'}, {'col_name': 'release date'}], 'foreign_key_columns': ['press id', 'author id'], 'primary_keys': ['book id']}]
Find the titles and publish dates of the top 5 best sale books.
SELECT title , release_date FROM book ORDER BY sale_amount DESC LIMIT 5
book_press
[{'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_name': 'author id'}, {'col_name': 'press id'}, {'col_name': 'sale amount'}, {'col_name': 'release date'}], 'foreign_key_columns': ['press id', 'author id'], 'primary_keys': ['book id']}]
What are the 5 best books in terms of sale amount? Give me their titles and release dates.
SELECT title , release_date FROM book ORDER BY sale_amount DESC LIMIT 5
book_press
[{'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_name': 'author id'}, {'col_name': 'press id'}, {'col_name': 'sale amount'}, {'col_name': 'release date'}], 'foreign_key_columns': ['press id', 'author id'], 'primary_keys': ['book id']}]
Find the book series that have some book selling more than 1000 and some book less 500.
SELECT book_series FROM book WHERE sale_amount > 1000 INTERSECT SELECT book_series FROM book WHERE sale_amount < 500
book_press
[{'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_name': 'author id'}, {'col_name': 'press id'}, {'col_name': 'sale amount'}, {'col_name': 'release date'}], 'foreign_key_columns': ['press id', 'author id'], 'primary_keys': ['book id']}]
Which book series contain both books with sale amount above 1000 and books with sale amount below 500?
SELECT book_series FROM book WHERE sale_amount > 1000 INTERSECT SELECT book_series FROM book WHERE sale_amount < 500
book_press
[{'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_name': 'author id'}, {'col_name': 'press id'}, {'col_name': 'sale amount'}, {'col_name': 'release date'}], 'foreign_key_columns': ['press id', 'author id'], 'primary_keys': ['book id']}]
Find the name of authors who publish their books in both "MM" and "LT" series.
SELECT t1.name FROM author AS t1 JOIN book AS t2 ON t1.author_id = t2.author_id WHERE t2.book_series = 'MM' INTERSECT SELECT t1.name FROM author AS t1 JOIN book AS t2 ON t1.author_id = t2.author_id WHERE t2.book_series = 'LT'
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_...
Which authors publish books in both "MM" and "LT" series? Give me the author names.
SELECT t1.name FROM author AS t1 JOIN book AS t2 ON t1.author_id = t2.author_id WHERE t2.book_series = 'MM' INTERSECT SELECT t1.name FROM author AS t1 JOIN book AS t2 ON t1.author_id = t2.author_id WHERE t2.book_series = 'LT'
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_...
Find the name and age of the authors who do not have any book in the record.
SELECT name , age FROM author WHERE author_id NOT IN (SELECT author_id FROM book)
book_press
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'age'}, {'col_name': 'gender'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'book', 'table_schema': [{'col_name': 'book id'}, {'col_name': 'title'}, {'col_name': 'book series'}, {'col_...