interaction_utterance
sequencelengths
0
6
interaction_query
sequencelengths
0
6
final_utterance
stringlengths
19
224
final_query
stringlengths
22
577
db_id
stringclasses
140 values
[ "Show the order id for all order items.", "Also show the product id.", "For each order, show the number of products." ]
[ "SELECT order_id FROM Order_items", "SELECT order_id, product_id FROM Order_items", "SELECT order_id , count(DISTINCT product_id) FROM Order_items GROUP BY order_id" ]
Show order ids and the number of products in each order.
SELECT order_id , count(DISTINCT product_id) FROM Order_items GROUP BY order_id
customers_and_invoices
[ "Show the order id for each order item.", "For each of those items, also show the product quantities.", "For each order, what is the total quantity?" ]
[ "SELECT order_id FROM Order_items", "SELECT order_id , product_quantity FROM Order_items", "SELECT order_id , sum(product_quantity) FROM Order_items GROUP BY order_id" ]
Show order ids and the total quantity in each order.
SELECT order_id , sum(product_quantity) FROM Order_items GROUP BY order_id
customers_and_invoices
[ "Show all information about department heads.", "How many heads of departments are there?", "How many heads of department are older than 56?" ]
[ "SELECT * FROM head", "SELECT count(*) FROM head", "SELECT count(*) FROM head WHERE age > 56" ]
How many heads of the departments are older than 56 ?
SELECT count(*) FROM head WHERE age > 56
department_management
[ "Show the names of the heads of departments.", "Show the state where each department head was born.", "Show the age of the heads of departments.", "Please order this information by heads' ages." ]
[ "SELECT name FROM head", "SELECT born_state FROM head", "SELECT age FROM head", "SELECT name , born_state , age FROM head ORDER BY age" ]
List the name, born state and age of the heads of departments ordered by age.
SELECT name , born_state , age FROM head ORDER BY age
department_management
[ "List the creation year of each department.", "List the name of each department.", "List the budget of each department.", "List the creation year, name and budget of each department." ]
[ "SELECT creation FROM department", "SELECT name FROM department", "SELECT budget_in_billions FROM department", "SELECT creation , name , budget_in_billions FROM department" ]
List the creation year, name and budget of each department.
SELECT creation , name , budget_in_billions FROM department
department_management
[ "List the budget of each department.", "What are the maximum and minimum budget of the departments?" ]
[ "SELECT budget_in_billions FROM department", "SELECT max(budget_in_billions) , min(budget_in_billions) FROM department" ]
What are the maximum and minimum budget of the departments?
SELECT max(budget_in_billions) , min(budget_in_billions) FROM department
department_management
[ "How many employees does each department have?", "What is the number of employees of the departments whose rank is between 10 and 15?", "What is the average number of employees of these departments?" ]
[ "SELECT num_employees FROM department", "SELECT num_employees FROM department WHERE ranking BETWEEN 10 AND 15", "SELECT avg(num_employees) FROM department WHERE ranking BETWEEN 10 AND 15" ]
What is the average number of employees of the departments whose rank is between 10 and 15?
SELECT avg(num_employees) FROM department WHERE ranking BETWEEN 10 AND 15
department_management
[ "Show all the names of the department heads.", "Among these department heads, who was born outside California?" ]
[ "SELECT name FROM head", "SELECT name FROM head WHERE born_state != 'California'" ]
What are the names of the heads who are born outside the California state?
SELECT name FROM head WHERE born_state != 'California'
department_management
[ "What are the creation years of the departments?", "Which secretaries were born in Alabama?", "What are the distinct creation years of the departments managed by a secretary born in state 'Alabama'?" ]
[ "SELECT creation FROM department", "SELECT * FROM head WHERE born_state = 'Alabama'", "SELECT DISTINCT T1.creation FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T3.born_state = 'Alabama'" ]
What are the distinct creation years of the departments managed by a secretary born in state 'Alabama'?
SELECT DISTINCT T1.creation FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T3.born_state = 'Alabama'
department_management
[ "What are the names of the states where department heads were born?", "How many heads were born in each state?", "What are the names of the states where at least 3 heads were born?" ]
[ "SELECT born_state FROM head", "SELECT born_state, count(*) FROM head GROUP BY born_state", "SELECT born_state FROM head GROUP BY born_state HAVING count(*) >= 3" ]
What are the names of the states where at least 3 heads were born?
SELECT born_state FROM head GROUP BY born_state HAVING count(*) >= 3
department_management
[ "What are the years in which departments were established?", "In which year were the most departments established?" ]
[ "SELECT creation FROM department GROUP BY creation", "SELECT creation FROM department GROUP BY creation ORDER BY count(*) DESC LIMIT 1" ]
In which year were most departments established?
SELECT creation FROM department GROUP BY creation ORDER BY count(*) DESC LIMIT 1
department_management
[ "Show the names and number of employees of each department.", "Who are the department heads whose temporary acting value is \"Yes\"?", "Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes'." ]
[ "SELECT name , num_employees FROM department", "SELECT * FROM management WHERE temporary_acting = 'Yes'", "SELECT T1.name , T1.num_employees FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id WHERE T2.temporary_acting = 'Yes'" ]
Show the name and number of employees for the departments managed by heads whose temporary acting value is 'Yes'?
SELECT T1.name , T1.num_employees FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id WHERE T2.temporary_acting = 'Yes'
department_management
[ "List the acting statuses.", "How many acting statuses are there?" ]
[ "SELECT temporary_acting FROM management", "SELECT count(DISTINCT temporary_acting) FROM management" ]
How many acting statuses are there?
SELECT count(DISTINCT temporary_acting) FROM management
department_management
[ "How many departments are there?", "How many departments are led by heads who are mentioned in the database?", "How many departments are led by heads who are not mentioned?" ]
[ "SELECT count(*) FROM department", "SELECT count(*) FROM department WHERE department_id IN (SELECT department_id FROM management);", "SELECT count(*) FROM department WHERE department_id NOT IN (SELECT department_id FROM management);" ]
How many departments are led by heads who are not mentioned?
SELECT count(*) FROM department WHERE department_id NOT IN (SELECT department_id FROM management);
department_management
[ "What are the dictinct ages of the department heads?", "List the ages of the heads who are acting." ]
[ "SELECT DISTINCT T1.age FROM management AS T2 JOIN head AS T1 ON T1.head_id = T2.head_id", "SELECT DISTINCT T1.age FROM management AS T2 JOIN head AS T1 ON T1.head_id = T2.head_id WHERE T2.temporary_acting = 'Yes'" ]
What are the distinct ages of the heads who are acting?
SELECT DISTINCT T1.age FROM management AS T2 JOIN head AS T1 ON T1.head_id = T2.head_id WHERE T2.temporary_acting = 'Yes'
department_management
[ "List the states where each secretary was born.", "List the information of the secretary of 'Treasury' department and the secretary of 'Homeland Security' department.", "List the states where both the secretary of 'Treasury' department and the secretary of 'Homeland Security' were born." ]
[ "SELECT DISTINCT born_state FROM head", "SELECT T3.name, T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T1.name = 'Treasury' or T1.name = 'Homeland Security'", "SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T1.name = 'Treasury' INTERSECT SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T1.name = 'Homeland Security'" ]
List the states where both the secretary of 'Treasury' department and the secretary of 'Homeland Security' were born.
SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T1.name = 'Treasury' INTERSECT SELECT T3.born_state FROM department AS T1 JOIN management AS T2 ON T1.department_id = T2.department_id JOIN head AS T3 ON T2.head_id = T3.head_id WHERE T1.name = 'Homeland Security'
department_management
[ "How many heads does each department have?", "Which department has more than 1 head at a time?", "List the id, name and the number of heads of these departments." ]
[ "SELECT T1.name , count(*) FROM management AS T2 JOIN department AS T1 ON T1.department_id = T2.department_id GROUP BY T1.department_id", "SELECT T1.department_id , T1.name FROM management AS T2 JOIN department AS T1 ON T1.department_id = T2.department_id GROUP BY T1.department_id HAVING count(*) > 1", "SELECT T1.department_id , T1.name , count(*) FROM management AS T2 JOIN department AS T1 ON T1.department_id = T2.department_id GROUP BY T1.department_id HAVING count(*) > 1" ]
Which department has more than 1 head at a time? List the id, name and the number of heads.
SELECT T1.department_id , T1.name , count(*) FROM management AS T2 JOIN department AS T1 ON T1.department_id = T2.department_id GROUP BY T1.department_id HAVING count(*) > 1
department_management
[ "How many cities are there", "How many cities have hosted events?", "Wihch city hosted events in the most recent year?", "Show its id." ]
[ "SELECT COUNT(*) FROM City", "SELECT count(DISTINCT city) FROM City as T1 JOIN Hosting_City as T2 on T1.City_ID = T2.Host_City", "SELECT T1.City FROM City as T1 JOIN Hosting_City as T2 on T1.City_ID = T2.Host_City ORDER BY YEAR DESC LIMIT 1", "SELECT host_city FROM hosting_city ORDER BY YEAR DESC LIMIT 1" ]
What is id of the city that hosted events in the most recent year?
SELECT host_city FROM hosting_city ORDER BY YEAR DESC LIMIT 1
city_record
[ "Show the names of the cities.", "Which of them were a host city after 2008?", "How about the cities that were a host city after 2010?" ]
[ "SELECT City FROM City", "SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T2.year > 2008", "SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T2.year > 2010" ]
Find the cities which were once a host city after 2010?
SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T2.year > 2010
city_record
[ "How many cities have hosted events?", "For each city, how many events has it hosted?", "Which city has hosted the most events?" ]
[ "SELECT COUNT(DISTINCT city) FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city", "SELECT T1.city, COUNT(*) FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY T2.host_city", "SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY T2.host_city ORDER BY count(*) DESC LIMIT 1" ]
Which city has hosted the most events?
SELECT T1.city FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city GROUP BY T2.host_city ORDER BY count(*) DESC LIMIT 1
city_record
[ "How many events has \"Nanjing ( Jiangsu )\" hosted?", "What is the date of the competition \"1994 FIFA World Cup qualification\" hosted by \"Nanjing ( Jiangsu )\"?", "How about the venue?" ]
[ "SELECT COUNT(*) FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE City = \"Nanjing ( Jiangsu )\"", "SELECT T3.Date FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city JOIN MATCH AS T3 ON T2.match_id = T3.match_id WHERE T1.city = \"Nanjing ( Jiangsu )\" AND T3.competition = \"1994 FIFA World Cup qualification\"", "SELECT T3.venue FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city JOIN MATCH AS T3 ON T2.match_id = T3.match_id WHERE T1.city = \"Nanjing ( Jiangsu )\" AND T3.competition = \"1994 FIFA World Cup qualification\"" ]
What is the venue of the competition "1994 FIFA World Cup qualification" hosted by "Nanjing ( Jiangsu )"?
SELECT T3.venue FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city JOIN MATCH AS T3 ON T2.match_id = T3.match_id WHERE T1.city = "Nanjing ( Jiangsu )" AND T3.competition = "1994 FIFA World Cup qualification"
city_record
[ "How many events has \"Shanghai\" hosted?", "Give me the temperature of Shanghai in March.", "How about the temperature in January?" ]
[ "SELECT COUNT(*) FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE City = \"Shanghai\"", "SELECT T2.Mar FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T1.city = \"Shanghai\"", "SELECT T2.Jan FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T1.city = \"Shanghai\"" ]
Give me the temperature of Shanghai in January.
SELECT T2.Jan FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T1.city = "Shanghai"
city_record
[ "How many events has \"Taizhou ( Zhejiang )\" hosted?", "What event did it host?", "What is the host year of this city?" ]
[ "SELECT COUNT(*) FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE City = \"Taizhou ( Zhejiang )\"", "SELECT T3.Competition FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city JOIN match AS T3 ON T2.MATCH_ID = T3.MATCH_ID WHERE T1.city = \"Taizhou ( Zhejiang )\"", "SELECT T2.year FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T1.city = \"Taizhou ( Zhejiang )\"" ]
What is the host year of city "Taizhou ( Zhejiang )"?
SELECT T2.year FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T1.city = "Taizhou ( Zhejiang )"
city_record
[ "What is the average regional population?", "Which city has the largest regional population?", "What are the top three cities with the largest regional population?" ]
[ "SELECT AVG(regional_population) FROM city", "SELECT city FROM city ORDER BY regional_population DESC LIMIT 1", "SELECT city FROM city ORDER BY regional_population DESC LIMIT 3" ]
Which three cities have the largest regional population?
SELECT city FROM city ORDER BY regional_population DESC LIMIT 3
city_record
[ "What is the average GDP among all cities?", "What is the minimum GDP?", "Please also list the city name." ]
[ "SELECT AVG(GDP) FROM city", "SELECT GDP FROM city ORDER BY GDP LIMIT 1", "SELECT city , GDP FROM city ORDER BY GDP LIMIT 1" ]
Which city has the lowest GDP? Please list the city name and its GDP.
SELECT city , GDP FROM city ORDER BY GDP LIMIT 1
city_record
[ "What is the average temperature in March?", "How about February?", "In this month, which city has the highest temperature?" ]
[ "SELECT AVG(MAR) FROM temperature", "SELECT AVG(FEB) FROM temperature", "SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id ORDER BY T2.Feb DESC LIMIT 1" ]
Which city has the highest temperature in February?
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id ORDER BY T2.Feb DESC LIMIT 1
city_record
[ "What is the average temperature of all cities in October?", "How many cities are there whose temperature in March is lower than that in July ?", "What are the city names?", "Please also show cities whose temperature in March is higher than that in Oct." ]
[ "SELECT AVG(OCT) FROM temperature", "SELECT COUNT(*) FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul", "SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul", "SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul OR T2.Mar > T2.Oct" ]
Give me a list of cities whose temperature in March is lower than that in July or higher than that in Oct?
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul OR T2.Mar > T2.Oct
city_record
[ "Which cities have hosted events?", "What is the average temperature in March of these cities?", "Among these cities, whose temperature in Mar is lower than that in July?" ]
[ "SELECT City FROM City AS T1 JOIN Hosting_City AS T2 on T1.City_ID = T2.Host_City", "SELECT AVG(MAR) FROM City AS T1 JOIN Hosting_City AS T2 on T1.City_ID = T2.Host_City JOIN Temperature AS T3 ON T3.City_ID = T2.Host_City", "SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul INTERSECT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city" ]
Give me a list of cities whose temperature in Mar is lower than that in July and which have also served as host cities?
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul INTERSECT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city
city_record
[ "Which cities have never hosted an event?", "What is the average temperature in Dec of these cities?", "How about the cities whose temperature in Mar is lower than that in Dec?" ]
[ "SELECT City FROM City EXCEPT SELECT City FROM City AS T1 JOIN Hosting_City AS T2 on T1.City_ID = T2.Host_City", "SELECT AVG(DEC) FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id EXCEPT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city", "SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Dec EXCEPT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city" ]
Give me a list of cities whose temperature in Mar is lower than that in Dec and which have never been host cities.
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Dec EXCEPT SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city
city_record
[ "How many cities are there that were once host cities?", "How many cities are there whose temperature in Feb is higher than that in Jun?", "Please list the city names of the above results." ]
[ "SELECT COUNT(DISTINCT T1.city) FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city", "SELECT Count(*) FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Feb > T2.Jun", "SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Feb > T2.Jun UNION SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city" ]
Give me a list of cities whose temperature in Feb is higher than that in Jun or cities that were once host cities?
SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Feb > T2.Jun UNION SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city
city_record
[ "Which city has the smallest regional population?", "How many cities are there that have a regional population over 8000000 or under 5000000?", "Please show the names of these cities." ]
[ "SELECT City FROM CITY ORDER BY regional_population ASC LIMIT 1", "SELECT COUNT(*) FROM city WHERE regional_population > 8000000 OR regional_population < 5000000", "SELECT city FROM city WHERE regional_population > 8000000 UNION SELECT city FROM city WHERE regional_population < 5000000" ]
Please give me a list of cities whose regional population is over 8000000 or under 5000000.
SELECT city FROM city WHERE regional_population > 8000000 UNION SELECT city FROM city WHERE regional_population < 5000000
city_record
[ "Which city has the smallest GDP?", "Which city has the largest population?", "What is its GDP?" ]
[ "SELECT City FROM CITY ORDER BY gdp ASC LIMIT 1", "SELECT CITY FROM city ORDER BY Regional_Population DESC LIMIT 1", "SELECT gdp FROM city ORDER BY Regional_Population DESC LIMIT 1" ]
what is the GDP of the city with the largest population.
SELECT gdp FROM city ORDER BY Regional_Population DESC LIMIT 1
city_record
[ "How many branches are there?", "What is their average membership amounts?", "How many branches have more membership than that?" ]
[ "SELECT count(*) FROM branch", "SELECT avg(membership_amount) FROM branch", "SELECT count(*) FROM branch WHERE membership_amount > (SELECT avg(membership_amount) FROM branch)" ]
How many branches where have more than average number of memberships are there?
SELECT count(*) FROM branch WHERE membership_amount > (SELECT avg(membership_amount) FROM branch)
shop_membership
[ "How many branches are there?", "How many membership does each of them have?", "Show me the top three of them.", "Give me only the name." ]
[ "SELECT count(*) FROM branch", "SELECT name, membership_amount FROM branch", "SELECT name, membership_amount FROM branch ORDER BY membership_amount DESC LIMIT 3", "SELECT name FROM branch ORDER BY membership_amount DESC LIMIT 3" ]
What are names for top three branches with most number of membership?
SELECT name FROM branch ORDER BY membership_amount DESC LIMIT 3
shop_membership
[ "Give me the name of all branches.", "Show me all open years when any of them were opened.", "Among them, during which years, at least two shops were opened?" ]
[ "SELECT name FROM branch", "SELECT open_year FROM branch GROUP BY open_year", "SELECT open_year FROM branch GROUP BY open_year HAVING count(*) >= 2" ]
List all open years when at least two shops are opened.
SELECT open_year FROM branch GROUP BY open_year HAVING count(*) >= 2
shop_membership
[ "How many branches are there?", "What about opened in 2011 or located at London?", "Show me the amount of memberships for them.", "What are the minimum and maximum among them?" ]
[ "SELECT count(*) FROM branch", "SELECT count(*) FROM branch WHERE open_year = 2011 OR city = 'London'", "SELECT membership_amount FROM branch WHERE open_year = 2011 OR city = 'London'", "SELECT min(membership_amount) , max(membership_amount) FROM branch WHERE open_year = 2011 OR city = 'London'" ]
Show minimum and maximum amount of memberships for all branches opened in 2011 or located at city London.
SELECT min(membership_amount) , max(membership_amount) FROM branch WHERE open_year = 2011 OR city = 'London'
shop_membership
[ "How many branches are there?", "What about before 2010?", "Can you show me those for each city?" ]
[ "SELECT count(*) FROM branch", "SELECT count(*) FROM branch WHERE open_year < 2010", "SELECT city, count(*) FROM branch WHERE open_year < 2010 GROUP BY city" ]
Show the city and the number of branches opened before 2010 for each city.
SELECT city , count(*) FROM branch WHERE open_year < 2010 GROUP BY city
shop_membership
[ "How many different membership levels are there?", "How many members are there in the record?", "Which membership level has the most number of members?" ]
[ "SELECT LEVEL FROM member GROUP BY LEVEL", "SELECT count(*) FROM member", "SELECT LEVEL FROM member GROUP BY LEVEL ORDER BY count(*) DESC LIMIT 1" ]
Show the membership level with most number of members.
SELECT LEVEL FROM member GROUP BY LEVEL ORDER BY count(*) DESC LIMIT 1
shop_membership
[ "How many membership registrations are there in file?", "Show me the member names and branch names associated with them.", "List them in order of their register years." ]
[ "SELECT count(*) FROM membership_register_branch", "SELECT T3.name , T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id", "SELECT T3.name , T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id ORDER BY T1.register_year" ]
Show all member names and registered branch names sorted by register year.
SELECT T3.name , T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id ORDER BY T1.register_year
shop_membership
[ "How many membership registrations are there in file?", "How many of those were registered after 2015?", "What about for each branch?", "Show me the name for each branch instead of id." ]
[ "SELECT count(*) FROM membership_register_branch", "SELECT count(*) FROM membership_register_branch WHERE register_year > 2015", "SELECT branch_id, count(*) FROM membership_register_branch WHERE register_year > 2015 GROUP BY branch_id", "SELECT T2.name , count(*) FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T1.register_year > 2015 GROUP BY T2.branch_id" ]
Show all branch names with the number of members in each branch registered after 2015.
SELECT T2.name , count(*) FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T1.register_year > 2015 GROUP BY T2.branch_id
shop_membership
[ "How many membership registrations are there in file?", "Show me the id of members in any of them.", "Give me the name of members who are not one of those." ]
[ "SELECT count(*) FROM membership_register_branch", "SELECT member_id FROM membership_register_branch", "SELECT name FROM member WHERE member_id NOT IN (SELECT member_id FROM membership_register_branch)" ]
Show member names without any registered branch.
SELECT name FROM member WHERE member_id NOT IN (SELECT member_id FROM membership_register_branch)
shop_membership
[ "How many membership registrations are there in file?", "Show me the id of branches in any of them.", "Give me the name of branches which are not one of those.", "What about their cities?" ]
[ "SELECT count(*) FROM membership_register_branch", "SELECT branch_id FROM membership_register_branch", "SELECT name FROM branch WHERE branch_id NOT IN (SELECT branch_id FROM membership_register_branch)", "SELECT name , city FROM branch WHERE branch_id NOT IN (SELECT branch_id FROM membership_register_branch)" ]
List the branch name and city without any registered members.
SELECT name , city FROM branch WHERE branch_id NOT IN (SELECT branch_id FROM membership_register_branch)
shop_membership
[ "How many membership registrations are there in 2016?", "What about for each branch?", "Show me the name of branch with the most of them.", "What about its open year?" ]
[ "SELECT COUNT(*) FROM membership_register_branch WHERE register_year = 2016", "SELECT branch_id, COUNT(*) FROM membership_register_branch WHERE register_year = 2016 GROUP BY branch_id", "SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T1.register_year = 2016 GROUP BY T2.branch_id ORDER BY count(*) DESC LIMIT 1", "SELECT T2.name , T2.open_year FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T1.register_year = 2016 GROUP BY T2.branch_id ORDER BY count(*) DESC LIMIT 1" ]
What is the name and open year for the branch with most number of memberships registered in 2016?
SELECT T2.name , T2.open_year FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T1.register_year = 2016 GROUP BY T2.branch_id ORDER BY count(*) DESC LIMIT 1
shop_membership
[ "How many membership registrations are there in 2016?", "Show me the name of members in them.", "Also include their hometowns." ]
[ "SELECT COUNT(*) FROM membership_register_branch WHERE register_year = 2016", "SELECT T2.name FROM membership_register_branch AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T1.register_year = 2016", "SELECT T2.name , T2.hometown FROM membership_register_branch AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T1.register_year = 2016" ]
Show the member name and hometown who registered a branch in 2016.
SELECT T2.name , T2.hometown FROM membership_register_branch AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T1.register_year = 2016
shop_membership
[ "How many branches were opened in 2001?", "Among them, how many also have more than 100 membership?", "Show me all cities with any of those branches." ]
[ "SELECT count(*) FROM branch WHERE open_year = 2001", "SELECT count(*) FROM branch WHERE open_year = 2001 AND membership_amount > 100", "SELECT city FROM branch WHERE open_year = 2001 AND membership_amount > 100" ]
Show all city with a branch opened in 2001 and a branch with more than 100 membership.
SELECT city FROM branch WHERE open_year = 2001 AND membership_amount > 100
shop_membership
[ "How many branches have more than 100 memberships?", "Give me all cities with any of those branches.", "What about cities without any of those branches?" ]
[ "SELECT COUNT(*) FROM branch WHERE membership_amount > 100", "SELECT city FROM branch WHERE membership_amount > 100", "SELECT city FROM branch EXCEPT SELECT city FROM branch WHERE membership_amount > 100" ]
Show all cities without a branch having more than 100 memberships.
SELECT city FROM branch EXCEPT SELECT city FROM branch WHERE membership_amount > 100
shop_membership
[ "How many purchases are there in 2018?", "How many of them were made through any branch in London?", "Show me the sum of total pounds of them." ]
[ "SELECT COUNT(*) FROM purchase WHERE year = 2018", "SELECT COUNT(*) FROM purchase AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T2.city = 'London' AND T1.year = 2018", "SELECT sum(total_pounds) FROM purchase AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T2.city = 'London' AND T1.year = 2018" ]
What is the sum of total pounds of purchase in year 2018 for all branches in London?
SELECT sum(total_pounds) FROM purchase AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id WHERE T2.city = 'London' AND T1.year = 2018
shop_membership
[ "How many purchases are there in file?", "Show me the id of members with level 6.", "How many purchases are for any of those members?" ]
[ "SELECT COUNT(*) FROM purchase", "SELECT MEMBER_ID FROM member WHERE LEVEL = 6", "SELECT count(*) FROM purchase AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T2.level = 6" ]
What is the total number of purchases for members with level 6?
SELECT count(*) FROM purchase AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id WHERE T2.level = 6
shop_membership
[ "How many members' hometown is in Louisville, Kentucky?", "Show me the name of branches with any of those members.", "Among them, which ones also have members from Hiram, Georgia?" ]
[ "SELECT count(*) FROM MEMBER WHERE hometown = 'Louisville , Kentucky'", "SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id WHERE T3.Hometown = 'Louisville, Kentucky'", "SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id WHERE T3.Hometown = 'Louisville , Kentucky' INTERSECT SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id WHERE T3.Hometown = 'Hiram, Georgia'" ]
Find the name of branches where have some members whose hometown is in Louisville, Kentucky and some in Hiram, Georgia.
SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id WHERE T3.Hometown = 'Louisville , Kentucky' INTERSECT SELECT T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id WHERE T3.Hometown = 'Hiram , Georgia'
shop_membership
[ "Show me all about perpetrator.", "How many are there?" ]
[ "SELECT * FROM perpetrator;", "SELECT count(*) FROM perpetrator;" ]
How many perpetrators are there?
SELECT count(*) FROM perpetrator;
perpetrator
[ "Show me the number of people killed by each perpetrator.", "List the date for each in descending order of the number of people killed." ]
[ "SELECT Killed FROM perpetrator;", "SELECT Date FROM perpetrator ORDER BY Killed DESC;" ]
List the date of perpetrators in descending order of the number of people killed.
SELECT Date FROM perpetrator ORDER BY Killed DESC;
perpetrator
[ "How many people has each perpetrator killed?", "How about injured?", "Sort the result in ascending order." ]
[ "SELECT Killed FROM perpetrator;", "SELECT Injured FROM perpetrator;", "SELECT Injured FROM perpetrator ORDER BY Injured ASC;" ]
List the number of people injured by perpetrators in ascending order.
SELECT Injured FROM perpetrator ORDER BY Injured ASC;
perpetrator
[ "How many people are injured in total by all perpetrators?", "How many perpetrators are there?", "What is the average number of people injured by all perpetrators?" ]
[ "SELECT sum(Injured) FROM perpetrator;", "SELECT count(*) FROM perpetrator;", "SELECT avg(Injured) FROM perpetrator;" ]
What is the average number of people injured by all perpetrators?
SELECT avg(Injured) FROM perpetrator;
perpetrator
[ "Show me the number of people killed by each perpetrator.", "Order the result in descending order.", "What's the location for the one who killed the most people?" ]
[ "SELECT Killed FROM perpetrator;", "SELECT Killed FROM perpetrator ORDER BY Killed DESC ;", "SELECT LOCATION FROM perpetrator ORDER BY Killed DESC LIMIT 1;" ]
What is the location of the perpetrator with the largest kills.
SELECT LOCATION FROM perpetrator ORDER BY Killed DESC LIMIT 1;
perpetrator
[ "How many people are there?", "What are their names?", "Order the result by descending height." ]
[ "SELECT count(*) FROM People;", "SELECT Name FROM People;", "SELECT Name FROM People ORDER BY Height ASC;" ]
What are the names of people in ascending order of height?
SELECT Name FROM People ORDER BY Height ASC;
perpetrator
[ "What are the heights of all people?", "How about their names?", "Show just the perpetrators' names." ]
[ "SELECT Height FROM people;", "SELECT Name FROM people;", "SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID;" ]
What are the names of perpetrators?
SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID;
perpetrator
[ "Show me the countries of the perpetrators.", "What are the names of perpetrators whose country is \"China\"?", "How about those whose country is not \"China\"?" ]
[ "SELECT Country FROM perpetrator;", "SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Country = \"China\";", "SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Country != \"China\";" ]
What are the names of perpetrators whose country is not "China"?
SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Country != "China";
perpetrator
[ "Show me the names of the perpetrators.", "Who has the largest height?", "How about the highest weight?" ]
[ "SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID;", "SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Height DESC LIMIT 1;", "SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Weight DESC LIMIT 1;" ]
What is the name of the perpetrator with the biggest weight.
SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Weight DESC LIMIT 1;
perpetrator
[ "Show me the names of all the perpetrators with a height of more than 1.84 meters.", "What's their average number of killed people?", "How about the total?" ]
[ "SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Height > 1.84;", "SELECT avg(T2.Killed) FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Height > 1.84;", "SELECT sum(T2.Killed) FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Height > 1.84;" ]
What is the total kills of the perpetrators with height more than 1.84.
SELECT sum(T2.Killed) FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Height > 1.84;
perpetrator
[ "Show me perpetrators' names.", "Among the result, who are in \"South Korea\"?", "How about China or Japan?" ]
[ "SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID;", "SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Country = \"South Korea\";", "SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Country = \"China\" OR T2.Country = \"Japan\"" ]
What are the names of perpetrators in country "China" or "Japan"?
SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Country = "China" OR T2.Country = "Japan"
perpetrator
[ "What are the number of people injured for each perpetrator?", "What are the heights of each perpetrator in descending order of the number of people they injured?" ]
[ "SELECT T1.Name, T2.Injured FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID;", "SELECT T1.Height FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Injured DESC;" ]
What are the heights of perpetrators in descending order of the number of people they injured?
SELECT T1.Height FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Injured DESC;
perpetrator
[ "What year corresponds with each perpetrator?", "How about country?", "Show each country and the corresponding number of perpetrators there." ]
[ "SELECT Year FROM perpetrator;", "SELECT Country FROM perpetrator;", "SELECT Country , COUNT(*) FROM perpetrator GROUP BY Country;" ]
What are the countries of perpetrators? Show each country and the corresponding number of perpetrators there.
SELECT Country , COUNT(*) FROM perpetrator GROUP BY Country;
perpetrator
[ "What are the countries of perpetrators? Show each country and the corresponding number of perpetrators there.", "Which country has the fewest perpetrators?", "How about the most?" ]
[ "SELECT Country , COUNT(*) FROM perpetrator GROUP BY Country;", "SELECT Country , COUNT(*) FROM perpetrator GROUP BY Country ORDER BY COUNT(*) ASC LIMIT 1;", "SELECT Country , COUNT(*) FROM perpetrator GROUP BY Country ORDER BY COUNT(*) DESC LIMIT 1;" ]
What is the country that has the most perpetrators?
SELECT Country , COUNT(*) FROM perpetrator GROUP BY Country ORDER BY COUNT(*) DESC LIMIT 1;
perpetrator
[ "What is the country that has the most perpetrators?", "Which ones have more more than 1 perpetrator?", "How about those with at least two perpetrators?" ]
[ "SELECT Country , COUNT(*) FROM perpetrator GROUP BY Country ORDER BY COUNT(*) DESC LIMIT 1;", "SELECT Country , COUNT(*) FROM perpetrator GROUP BY Country HAVING COUNT(*) <= 1;", "SELECT Country , COUNT(*) FROM perpetrator GROUP BY Country HAVING COUNT(*) >= 2;" ]
What are the countries that have at least two perpetrators?
SELECT Country , COUNT(*) FROM perpetrator GROUP BY Country HAVING COUNT(*) >= 2;
perpetrator
[ "For each perpetrator, show the year that corresponds?", "Show me their names.", "Sort the result in descending order by year." ]
[ "SELECT Year FROM perpetrator;", "SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID;", "SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Year DESC;" ]
List the names of perpetrators in descending order of the year.
SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Year DESC;
perpetrator
[ "Show me all about people.", "Which of those are perpetrators?", "Show the rest of peoples' names." ]
[ "SELECT * FROM people;", "SELECT Name FROM people WHERE People_ID IN (SELECT People_ID FROM perpetrator);", "SELECT Name FROM people WHERE People_ID NOT IN (SELECT People_ID FROM perpetrator);" ]
List the names of people that are not perpetrators.
SELECT Name FROM people WHERE People_ID NOT IN (SELECT People_ID FROM perpetrator);
perpetrator
[ "For each perpetrator, show the ids and his or her country.", "Also, show how many they have each injured.", "Which countries have perpetrators who have injured more than 50?", "Which of these also have perpetrators who have injured fewer than 20?" ]
[ "SELECT Country, Perpetrator_ID FROM perpetrator;", "SELECT Country, Perpetrator_ID, Injured FROM perpetrator;", "SELECT Country FROM perpetrator WHERE Injured > 50;", "SELECT Country FROM perpetrator WHERE Injured > 50 INTERSECT SELECT Country FROM perpetrator WHERE Injured < 20;" ]
Show the countries that have both perpetrators with injures more than 50 and perpetrators with injures smaller than 20.
SELECT Country FROM perpetrator WHERE Injured > 50 INTERSECT SELECT Country FROM perpetrator WHERE Injured < 20
perpetrator
[ "Show me the location for each perpetrator.", "What are the distinct locations?", "How many are there in the result?" ]
[ "SELECT Location FROM perpetrator;", "SELECT DISTINCT LOCATION FROM perpetrator;", "SELECT count(DISTINCT LOCATION) FROM perpetrator;" ]
How many distinct locations of perpetrators are there?
SELECT count(DISTINCT LOCATION) FROM perpetrator;
perpetrator
[ "What is the date for the perpetrator?", "Who's the tallest perpetrator?", "What's his date?" ]
[ "SELECT Date FROM perpetrator;", "SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Height DESC LIMIT 1", "SELECT T2.Date FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Height DESC LIMIT 1" ]
Show the date of the tallest perpetrator.
SELECT T2.Date FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Height DESC LIMIT 1
perpetrator
[ "how many departments are there?", "show all their info.", "where are they each located?", "what are the names of departments that are located in Houston?" ]
[ "SELECT COUNT(*) FROM department", "SELECT * FROM department", "SELECT Dlocation FROM department AS t1 JOIN dept_locations AS t2 ON t1.dnumber = t2.dnumber", "SELECT t1.dname FROM department AS t1 JOIN dept_locations AS t2 ON t1.dnumber = t2.dnumber WHERE t2.dlocation = 'Houston'" ]
Find the names of departments that are located in Houston.
SELECT t1.dname FROM department AS t1 JOIN dept_locations AS t2 ON t1.dnumber = t2.dnumber WHERE t2.dlocation = 'Houston'
company_1
[ "What are the captains names and ages?", "What is the average age for each rank?", "Per rank, how many are older than 50?" ]
[ "SELECT name, age from captain", "SELECT rank, avg(age) from captain GROUP by rank", "SELECT count(*) , rank FROM captain WHERE age < 50 GROUP BY rank" ]
How many captains younger than 50 are in each rank?
SELECT count(*) , rank FROM captain WHERE age < 50 GROUP BY rank
ship_1
[ "What are the names and ranks of captains?", "Which rank is most common?" ]
[ "SELECT name, rank from captain", "SELECT rank FROM captain GROUP BY rank ORDER BY count(*) DESC LIMIT 1" ]
Which rank is the most common among captains?
SELECT rank FROM captain GROUP BY rank ORDER BY count(*) DESC LIMIT 1
ship_1
[ "Give the classes of captains.", "Group by class and count.", "Which class has more than two?" ]
[ "SELECT Class from captain", "SELECT Class, count(*) from captain Group by class", "SELECT CLASS FROM captain GROUP BY CLASS HAVING count(*) > 2" ]
Which classes have more than two captains?
SELECT CLASS FROM captain GROUP BY CLASS HAVING count(*) > 2
ship_1
[ "How many captains are either Midshipman or Lieutenant?", "What are their names?" ]
[ "SELECT count(*) FROM captain WHERE rank = 'Midshipman' OR rank = 'Lieutenant'", "SELECT name FROM captain WHERE rank = 'Midshipman' OR rank = 'Lieutenant'" ]
Find the name of captains whose rank are either Midshipman or Lieutenant.
SELECT name FROM captain WHERE rank = 'Midshipman' OR rank = 'Lieutenant'
ship_1
[ "Order class by increasing age. Also show age.", "What are the average and minimum age of captains in different class?" ]
[ "SELECT class, age from captain Order by age", "SELECT avg(age) , min(age) , CLASS FROM captain GROUP BY CLASS" ]
What are the average and minimum age of captains in different class?
SELECT avg(age) , min(age) , CLASS FROM captain GROUP BY CLASS
ship_1
[ "Which ranks of captains are in the Cutter class?", "How about Armed schooner?", "Intersect those." ]
[ "SELECT DISTINCT rank FROM captain WHERE CLASS = 'Cutter'", "SELECT rank FROM captain WHERE CLASS = 'Armed schooner'", "SELECT rank FROM captain WHERE CLASS = 'Cutter' INTERSECT SELECT rank FROM captain WHERE CLASS = 'Armed schooner'" ]
Find the captain rank that has some captains in both Cutter and Armed schooner classes.
SELECT rank FROM captain WHERE CLASS = 'Cutter' INTERSECT SELECT rank FROM captain WHERE CLASS = 'Armed schooner'
ship_1
[ "For each class, what are the ranks?", "Find the captain rank that has no captain in Third-rate ship of the line class." ]
[ "SELECT DISTINCT class, rank from captain Order by class", "SELECT rank FROM captain EXCEPT SELECT rank FROM captain WHERE CLASS = 'Third-rate ship of the line'" ]
Find the captain rank that has no captain in Third-rate ship of the line class.
SELECT rank FROM captain EXCEPT SELECT rank FROM captain WHERE CLASS = 'Third-rate ship of the line'
ship_1
[ "Sort captains records by age.", "Just their names.", "limit it to the one youngest." ]
[ "SELECT * from captain order by age", "SELECT name from captain order by age", "SELECT name FROM captain ORDER BY age LIMIT 1" ]
What is the name of the youngest captain?
SELECT name FROM captain ORDER BY age LIMIT 1
ship_1
[ "What is the most recent build year?", "Which ships were built in the most recent year?", "Also give the type and flag." ]
[ "SELECT max(built_year) from ship", "SELECT name from ship where built_year in (SELECT max(built_year) from ship)", "SELECT name, type, flag from ship where built_year in (SELECT max(built_year) from ship)" ]
Find the name, type, and flag of the ships that were built in the most recent year.
SELECT name, type, flag from ship where built_year in (SELECT max(built_year) from ship)
ship_1
[ "Which flags are used?", "Which is most common?" ]
[ "SELECT DISTINCT flag from ship", "SELECT flag FROM ship GROUP BY flag ORDER BY count(*) DESC LIMIT 1" ]
Which flag is most widely used among all ships?
SELECT flag FROM ship GROUP BY flag ORDER BY count(*) DESC LIMIT 1
ship_1
[ "Which type of ship has flag Panama?", "How about Malta?", "Which types have ships with both flags?" ]
[ "SELECT DISTINCT TYPE FROM ship WHERE flag = 'Panama'", "SELECT TYPE FROM ship WHERE flag = 'Malta'", "SELECT TYPE FROM ship WHERE flag = 'Panama' INTERSECT SELECT TYPE FROM ship WHERE flag = 'Malta'" ]
Find the ship type that are used by both ships with Panama and Malta flags.
SELECT TYPE FROM ship WHERE flag = 'Panama' INTERSECT SELECT TYPE FROM ship WHERE flag = 'Malta'
ship_1
[ "What are the distinct build years of ships?", "Which is more common?" ]
[ "SELECT DISTINCT built_year from ship", "SELECT built_year FROM ship GROUP BY built_year ORDER BY count(*) DESC LIMIT 1" ]
In which year were most of ships built?
SELECT built_year FROM ship GROUP BY built_year ORDER BY count(*) DESC LIMIT 1
ship_1
[ "List each ship with its captains.", "Which ship has more than one captain?" ]
[ "SELECT t1.name, t2.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id", "SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id GROUP BY t2.ship_id HAVING count(*) > 1" ]
Find the name of the ships that have more than one captain.
SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id GROUP BY t2.ship_id HAVING count(*) > 1
ship_1
[ "Which ship ids are not in the captain records?", "Give their names and classes" ]
[ "SELECT ship_id FROM ship EXCEPT SELECT ship_id FROM captain", "SELECT name , CLASS FROM ship WHERE ship_id NOT IN (SELECT ship_id FROM captain)" ]
what are the names and classes of the ships that do not have any captain yet?
SELECT name , CLASS FROM ship WHERE ship_id NOT IN (SELECT ship_id FROM captain)
ship_1
[ "Who is the youngest captain?", "Which ship does he steer?" ]
[ "SELECT name from captain order by age asc limit 1", "SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id ORDER BY t2.age LIMIT 1" ]
Find the name of the ship that is steered by the youngest captain.
SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id ORDER BY t2.age LIMIT 1
ship_1
[ "Which ship ids are steered by captains with the Midshipman rank?", "Which are not?", "What are their names and flags?" ]
[ "SELECT DISTINCT ship_id FROM captain WHERE rank = 'Midshipman'", "SELECT ship_id from ship EXCEPT SELECT ship_id FROM captain WHERE rank = 'Midshipman'", "SELECT name , flag FROM ship WHERE ship_id NOT IN (SELECT ship_id FROM captain WHERE rank = 'Midshipman')" ]
Find the name and flag of ships that are not steered by any captain with Midshipman rank.
SELECT name , flag FROM ship WHERE ship_id NOT IN (SELECT ship_id FROM captain WHERE rank = 'Midshipman')
ship_1
[ "Show me the names of all the stadiums.", "How many home games did each of them hold?", "Show me the maxium, minimum, and average of them." ]
[ "SELECT name FROM Stadium", "SELECT name, home_games FROM Stadium", "SELECT max(home_games) , min(home_games) , avg(home_games) FROM stadium" ]
What are the maximum, minimum and average home games each stadium held?
SELECT max(home_games) , min(home_games) , avg(home_games) FROM stadium
game_injury
[ "Show me all the players who got injured.", "Show me the date of the game that causes Walter Samuel to get injured?", "What about its season?" ]
[ "SELECT Player FROM injury_accident", "SELECT T1.Date FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id WHERE T2.player = 'Walter Samuel'", "SELECT T1.season FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id WHERE T2.player = 'Walter Samuel'" ]
What is the season of the game which causes the player 'Walter Samuel' to get injured?
SELECT T1.season FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id WHERE T2.player = 'Walter Samuel'
game_injury
[ "Show me all the players who got injured.", "What about their game ids?", "Which games caused at least two injury accidents?", "Show me their ids, scores, and dates." ]
[ "SELECT Player FROM injury_accident", "SELECT Player, game_id FROM injury_accident", "SELECT game_id FROM injury_accident GROUP BY game_id HAVING count(*) >= 2", "SELECT T1.id , T1.score , T1.date FROM game AS T1 JOIN injury_accident AS T2 ON T2.game_id = T1.id GROUP BY T1.id HAVING count(*) >= 2" ]
What are the ids, scores, and dates of the games which caused at least two injury accidents?
SELECT T1.id , T1.score , T1.date FROM game AS T1 JOIN injury_accident AS T2 ON T2.game_id = T1.id GROUP BY T1.id HAVING count(*) >= 2
game_injury
[ "Show me all the injury accidents.", "Show me distinct names of the stadium in which those accidents happened.", "Show me the id and name of the one where the most injury accidents happened." ]
[ "SELECT * FROM injury_accident", "SELECT distinct T1.name FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id JOIN injury_accident AS T3 ON T2.id = T3.game_id", "SELECT T1.id , T1.name FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id JOIN injury_accident AS T3 ON T2.id = T3.game_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1" ]
What are the id and name of the stadium where the most injury accidents happened?
SELECT T1.id , T1.name FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id JOIN injury_accident AS T3 ON T2.id = T3.game_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1
game_injury
[ "Show me all the injuries.", "Show me the ids of the games where those of 'Foot injury' or 'Knee problem' happened.", "What about their seasons and stadiums?" ]
[ "SELECT injury FROM injury_accident", "SELECT game_id FROM injury_accident WHERE injury = 'Foot injury' OR injury = 'Knee problem'", "SELECT T1.season , T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.injury = 'Foot injury' OR T3.injury = 'Knee problem'" ]
In which season and which stadium did any player have an injury of 'Foot injury' or 'Knee problem'?
SELECT T1.season , T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.injury = 'Foot injury' OR T3.injury = 'Knee problem'
game_injury
[ "How many industry accidents are there?", "Show me their game ids.", "Which games are not one of them?", "How many are there?" ]
[ "SELECT count(*) FROM injury_accident", "SELECT game_id FROM injury_accident", "SELECT id FROM game WHERE id NOT IN ( SELECT game_id FROM injury_accident )", "SELECT count(*) FROM game WHERE id NOT IN ( SELECT game_id FROM injury_accident )" ]
How many games are free of injury accidents?
SELECT count(*) FROM game WHERE id NOT IN ( SELECT game_id FROM injury_accident )
game_injury
[ "Show me all distinct kinds of injuries.", "What about those happened after season 2010?", "How many are there?" ]
[ "SELECT distinct injury FROM injury_accident", "SELECT DISTINCT T1.injury FROM injury_accident AS T1 JOIN game AS T2 ON T1.game_id = T2.id WHERE T2.season > 2010", "SELECT count(DISTINCT T1.injury) FROM injury_accident AS T1 JOIN game AS T2 ON T1.game_id = T2.id WHERE T2.season > 2010" ]
How many distinct kinds of injuries happened after season 2010?
SELECT count(DISTINCT T1.injury) FROM injury_accident AS T1 JOIN game AS T2 ON T1.game_id = T2.id WHERE T2.season > 2010
game_injury
[ "Show me the name of players that got injured?", "Give me the id of the games where Walter Samuel and Thiago Motta got injured.", "What about the name of the stadium where both of them got injured?" ]
[ "SELECT player FROM injury_accident", "SELECT game_id FROM injury_accident where player = 'Walter Samuel' or player = 'Thiago Motta'", "SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Walter Samuel' INTERSECT SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Thiago Motta'" ]
List the name of the stadium where both the player 'Walter Samuel' and the player 'Thiago Motta' got injured.
SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Walter Samuel' INTERSECT SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id WHERE T3.player = 'Thiago Motta'
game_injury
[ "Show me the game ids of all the injury accidents.", "Which stadium did each of them happen?", "Show me the name of stadiums which are not one of those.", "Also show me their average attendance and total attendance." ]
[ "SELECT game_id FROM injury_accident", "SELECT T2.name , T3.game_id FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id group by T3.game_id", "SELECT name FROM stadium EXCEPT SELECT T2.name FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id group by T3.game_id", "SELECT name , average_attendance , total_attendance FROM stadium EXCEPT SELECT T2.name , T2.average_attendance , T2.total_attendance FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id" ]
Show the name, average attendance, total attendance for stadiums where no accidents happened.
SELECT name , average_attendance , total_attendance FROM stadium EXCEPT SELECT T2.name , T2.average_attendance , T2.total_attendance FROM game AS T1 JOIN stadium AS T2 ON T1.stadium_id = T2.id JOIN injury_accident AS T3 ON T1.id = T3.game_id
game_injury
[ "Show me the name of all the stadiums.", "Which one contains \"Bank\" in it?" ]
[ "SELECT name FROM stadium", "SELECT name FROM stadium WHERE name LIKE \"%Bank%\"" ]
Which stadium name contains the substring "Bank"?
SELECT name FROM stadium WHERE name LIKE "%Bank%"
game_injury
[ "Show me the name of all the stadiums.", "How many games has each of them held?" ]
[ "SELECT name FROM stadium", "SELECT T1.name , count(*) FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id GROUP BY T1.id" ]
How many games has each stadium held?
SELECT T1.name , count(*) FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id GROUP BY T1.id
game_injury
[ "How many savings accounts are there?", "What are their saving balances?", "Remove Brown's saving balance.", "What is the total of these saving balances?" ]
[ "SELECT count(custid) FROM accounts", "SELECT T2.balance FROM accounts as T1 JOIN savings as T2 on T1.custid = T2.custid", "SELECT T2.balance FROM accounts as T1 JOIN savings as T2 on T1.custid = T2.custid where T1.name != \"Brown\"", "SELECT sum(T2.balance) FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T1.name != 'Brown'" ]
Find the total savings balance of all accounts except the account with name ‘Brown’.
SELECT sum(T2.balance) FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T1.name != 'Brown'
small_bank_1
[ "What is the maximum savings balance?", "What is the average?", "Who are names of the people that are above this average?", "How many of them are there?" ]
[ "SELECT max(balance)FROM savings", "SELECT avg(balance) FROM savings", "SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid where T2.balance > (SELECT avg(balance) FROM savings)", "SELECT count(*) FROM savings WHERE balance > (SELECT avg(balance) FROM savings)" ]
How many accounts have a savings balance above the average savings balance?
SELECT count(*) FROM savings WHERE balance > (SELECT avg(balance) FROM savings)
small_bank_1
[ "What account has the maximum checking balance?", "What is the checking balance?", "Show all the account names that have checking balances lower than this.", "also provide their ids." ]
[ "SELECT custid FROM checking where balance = (SELECT max(balance) FROM checking)", "SELECT max(balance) FROM checking", "SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT max(balance) FROM checking)", "SELECT T1.custid, T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT max(balance) FROM checking)" ]
Find the name and id of accounts whose checking balance is below the maximum checking balance.
SELECT T1.custid, T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T2.balance < (SELECT max(balance) FROM checking)
small_bank_1