1sf/bird-sql-train-with-schema huggingface dataset:
Database: menu
Tables: Dish, Menu, MenuPage, MenuItem
Columns (table index, column name): -1, *, 0, id, 0, name, 0, description, 0, menus_appeared, 0, times_appeared, 0, first_appeared, 0, last_appeared, 0, lowest_price, 0, highest_price, 1, id, 1, name, 1, sponsor, 1, event, 1, venue, 1, place, 1, physical_description, 1, occasion, 1, notes, 1, call_number, 1, keywords, 1, language, 1, date, 1, location, 1, location_type, 1, currency, 1, currency_symbol, 1, status, 1, page_count, 1, dish_count, 2, id, 2, menu_id, 2, page_number, 2, image_id, 2, full_height, 2, full_width, 2, uuid, 3, id, 3, menu_page_id, 3, price, 3, high_price, 3, dish_id, 3, created_at, 3, updated_at, 3, xpos, 3, ypos
Question: How many pages are there in the "Emil Kuehn" menu?
Evidence: Emil Kuehn is a name of menu;
SQL: SELECT SUM(CASE WHEN T1.name = 'Emil Kuehn' THEN 1 ELSE 0 END) FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id
Database: menu
Tables: Dish, Menu, MenuPage, MenuItem
Columns (table index, column name): -1, *, 0, id, 0, name, 0, description, 0, menus_appeared, 0, times_appeared, 0, first_appeared, 0, last_appeared, 0, lowest_price, 0, highest_price, 1, id, 1, name, 1, sponsor, 1, event, 1, venue, 1, place, 1, physical_description, 1, occasion, 1, notes, 1, call_number, 1, keywords, 1, language, 1, date, 1, location, 1, location_type, 1, currency, 1, currency_symbol, 1, status, 1, page_count, 1, dish_count, 2, id, 2, menu_id, 2, page_number, 2, image_id, 2, full_height, 2, full_width, 2, uuid, 3, id, 3, menu_page_id, 3, price, 3, high_price, 3, dish_id, 3, created_at, 3, updated_at, 3, xpos, 3, ypos
Question: How many menus include puree of split peas aux croutons?
Evidence: puree of split peas aux croutons is a name of dish;
SQL: SELECT SUM(CASE WHEN T1.name = 'Puree of split peas aux croutons' THEN 1 ELSE 0 END) FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id
Database: menu
Tables: Dish, Menu, MenuPage, MenuItem
Columns (table index, column name): -1, *, 0, id, 0, name, 0, description, 0, menus_appeared, 0, times_appeared, 0, first_appeared, 0, last_appeared, 0, lowest_price, 0, highest_price, 1, id, 1, name, 1, sponsor, 1, event, 1, venue, 1, place, 1, physical_description, 1, occasion, 1, notes, 1, call_number, 1, keywords, 1, language, 1, date, 1, location, 1, location_type, 1, currency, 1, currency_symbol, 1, status, 1, page_count, 1, dish_count, 2, id, 2, menu_id, 2, page_number, 2, image_id, 2, full_height, 2, full_width, 2, uuid, 3, id, 3, menu_page_id, 3, price, 3, high_price, 3, dish_id, 3, created_at, 3, updated_at, 3, xpos, 3, ypos
Question: What are the names of the dishes with a stable price that were created in April of 2011?
Evidence: dishes with a stable price refers to highest_price is null; created in April of 2011 refers to SUBSTR(created_at,1,4) = '2011' and SUBSTR(created_at, 7, 1) = '4';
SQL: SELECT T1.name FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE SUBSTR(T2.created_at, 1, 4) = '2011' AND SUBSTR(T2.created_at, 7, 1) = '4' AND T1.highest_price IS NULL
Database: menu
Tables: Dish, Menu, MenuPage, MenuItem
Columns (table index, column name): -1, *, 0, id, 0, name, 0, description, 0, menus_appeared, 0, times_appeared, 0, first_appeared, 0, last_appeared, 0, lowest_price, 0, highest_price, 1, id, 1, name, 1, sponsor, 1, event, 1, venue, 1, place, 1, physical_description, 1, occasion, 1, notes, 1, call_number, 1, keywords, 1, language, 1, date, 1, location, 1, location_type, 1, currency, 1, currency_symbol, 1, status, 1, page_count, 1, dish_count, 2, id, 2, menu_id, 2, page_number, 2, image_id, 2, full_height, 2, full_width, 2, uuid, 3, id, 3, menu_page_id, 3, price, 3, high_price, 3, dish_id, 3, created_at, 3, updated_at, 3, xpos, 3, ypos
Question: What is the name of the menu with the highest number of pages?
Evidence: highest number of pages refers to MAX(COUNT(page_number));
SQL: SELECT T1.name FROM Menu AS T1 INNER JOIN MenuPage AS T2 ON T1.id = T2.menu_id GROUP BY T2.menu_id ORDER BY COUNT(T2.page_number) DESC LIMIT 1
Database: menu
Tables: Dish, Menu, MenuPage, MenuItem
Columns (table index, column name): -1, *, 0, id, 0, name, 0, description, 0, menus_appeared, 0, times_appeared, 0, first_appeared, 0, last_appeared, 0, lowest_price, 0, highest_price, 1, id, 1, name, 1, sponsor, 1, event, 1, venue, 1, place, 1, physical_description, 1, occasion, 1, notes, 1, call_number, 1, keywords, 1, language, 1, date, 1, location, 1, location_type, 1, currency, 1, currency_symbol, 1, status, 1, page_count, 1, dish_count, 2, id, 2, menu_id, 2, page_number, 2, image_id, 2, full_height, 2, full_width, 2, uuid, 3, id, 3, menu_page_id, 3, price, 3, high_price, 3, dish_id, 3, created_at, 3, updated_at, 3, xpos, 3, ypos
Question: Provide the menu page ids of all the menu that includes mashed potatoes.
Evidence: mashed potatoes is a name of dish;
SQL: SELECT T2.menu_page_id FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T1.name = 'Mashed potatoes'
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: How many "Mountain-500 Black 42" were sold in total?
Evidence: Mountain-500 Black 42' is name of product; sold in total = SUM(Quantity);
SQL: SELECT SUM(T2.Quantity) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Mountain-500 Black, 42'
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: How much is the total amount of sales handled by Heather McBadden?
Evidence: total amount of sales = SUM(MULTIPLY(Quantity, Price));
SQL: SELECT SUM(T2.Quantity * T3.Price) FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T1.FirstName = 'Heather' AND T1.LastName = 'McBadden'
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: How many "Mountain-100 Silver, 38" were sold by Stearns MacFeather?
Evidence: Mountain-100 Silver, 38' is name of product;
SQL: SELECT SUM(T2.Quantity) FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T1.FirstName = 'Stearns' AND T1.LastName = 'MacFeather' AND T3.Name = 'Mountain-100 Silver, 38'
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: How many type of products did Dalton M. Coleman purchase?
SQL: SELECT COUNT(T2.ProductID) FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.FirstName = 'Dalton' AND T1.MiddleInitial = 'M' AND T1.LastName = 'Coleman'
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: What are the full names of the top 3 employees who handled the highest number of sales?
Evidence: full names of employees = FirstName, MiddleInitital, LastName; highest number of sales refers to MAX(COUNT(SalesID));
SQL: SELECT T1.FirstName, T1.MiddleInitial, T1.LastName FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID GROUP BY T2.SalesPersonID, T1.FirstName, T1.MiddleInitial, T1.LastName ORDER BY COUNT(T2.SalesID) DESC LIMIT 3
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: Among the "Mountain-500 Black" product types, which type was purchased the most?
Evidence: Mountain-500 Black product types refers to Name like 'Mountain-500 Black%'; purchased the most refers to MAX(SUM(Quantity));
SQL: SELECT T1.Name FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE 'Mountain-500 Black%' GROUP BY T2.Quantity, T1.Name ORDER BY SUM(T2.Quantity) DESC LIMIT 1
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: How many employees sold "ML Road Frame-W - Yellow, 40"?
Evidence: ML Road Frame-W - Yellow, 40' is name of product;
SQL: SELECT COUNT(T2.SalesPersonID) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'ML Road Frame-W - Yellow, 40'
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: How many chainring bolts were sold under sales ID 551971?
Evidence: Chainring Bolts' is name of product;
SQL: SELECT T1.Quantity FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Chainring Bolts' AND T1.SalesID = 551971
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: How many employees sold over 20,000 quantities of "Touring-2000 Blue, 50"?
Evidence: over 20,000 quantities refers to Quantity > 20000; 'Touring-2000 Blue, 50' is name of product;
SQL: SELECT COUNT(*) FROM ( SELECT SUM(Quantity) FROM Sales WHERE ProductID IN ( SELECT ProductID FROM Products WHERE Name = 'Touring-2000 Blue, 50' ) GROUP BY Quantity, SalesPersonID HAVING SUM(Quantity) > 20000 )
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: What is the total cost of all the "Road-650, Red, 60" products that Abraham E. Bennet sold?
Evidence: total cost = SUM(MULTIPLY(Quantity, Price)); 'Road-650, Red, 60' is name of product;
SQL: SELECT SUM(T2.Quantity * T3.Price) FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T1.FirstName = 'Abraham' AND T1.MiddleInitial = 'e' AND T1.LastName = 'Bennet' AND T3.Name = 'Road-650 Red, 60'
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: Which product has the highest total amount of quantity sold? Calculate its overall total price.
Evidence: highest total amount of quantity refers to MAX(Quantity); overall total price = SUM(MULTIPLY(Quantity, Price));
SQL: SELECT T1.Name, SUM(T2.Quantity * T1.Price) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID, T1.Name ORDER BY SUM(T2.Quantity) DESC LIMIT 1
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: List the first name of all the customers whose last name is Chen.
SQL: SELECT FirstName, LastName FROM Customers WHERE LastName = 'Chen'
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: Among the employee names, what is the most common middle initial?
Evidence: most common middle initial refers to MAX(COUNT(MiddleInitial));
SQL: SELECT MiddleInitial FROM Employees GROUP BY MiddleInitial ORDER BY COUNT(MiddleInitial) DESC LIMIT 1
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: What is the average price of products that cost between 100 and 200?
Evidence: average price = DIVIDE(SUM(Price, COUNT(Price))); cost refers to Price; Price BETWEEN 100 AND 200;
SQL: SELECT AVG(Price) FROM Products WHERE Price BETWEEN 100 AND 200
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: Find and list the full name of customers who bought products above-average quantity.
Evidence: full name of the customer = FirstName, MiddleInitial, LastName; above-average quantity = Quantity > AVG(Quantity);
SQL: SELECT T2.FirstName, T2.MiddleInitial, T2.LastName FROM Sales AS T1 INNER JOIN Customers AS T2 ON T1.CustomerID = T2.CustomerID GROUP BY T1.Quantity HAVING T1.Quantity > ( SELECT AVG(Quantity) FROM Sales )
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: Give the full name of the customer who bought the most amount of products.
Evidence: full name of the customer = FirstName, MiddleInitial, LastName; most amount of products refers to MAX(MULTIPLY(Quantity, Price));
SQL: SELECT T3.FirstName, T3.MiddleInitial, T3.LastName FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Customers AS T3 ON T2.CustomerID = T3.CustomerID ORDER BY T2.Quantity * T1.Price DESC LIMIT 1
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: Of the employees who sold Blade, who has the most amount of sales?
Evidence: Blade' is name of product; most amount of sales refers to MAX(MULTIPLY(Quantity, Price));
SQL: SELECT T1.FirstName, T1.MiddleInitial, T1.LastName FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID ORDER BY T2.Quantity * T3.Price DESC LIMIT 1
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: List the full name of customers who spend more than 50,000 in descending order the amount spend.
Evidence: full name of the customer = FirstName, MiddleInitial, LastName; more than 50,000 in the amount refers to MULTIPLY(Quantity, Price) > 50000;
SQL: SELECT DISTINCT T3.FirstName, T3.MiddleInitial, T3.LastName FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Customers AS T3 ON T2.CustomerID = T3.CustomerID WHERE T2.Quantity * T1.Price > 50000
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: Name the product that sold the most quantity.
Evidence: most quantity refers to MAX(Quantity);
SQL: SELECT T2.Name FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID ORDER BY T1.Quantity DESC LIMIT 1
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: Find and list the products that sold below the average quantity.
Evidence: below the average quantity refers to Quantity < AVG(Quantity);
SQL: SELECT DISTINCT T2.Name FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Quantity < ( SELECT AVG(Quantity) FROM Sales )
Database: menu
Tables: Dish, Menu, MenuPage, MenuItem
Columns (table index, column name): -1, *, 0, id, 0, name, 0, description, 0, menus_appeared, 0, times_appeared, 0, first_appeared, 0, last_appeared, 0, lowest_price, 0, highest_price, 1, id, 1, name, 1, sponsor, 1, event, 1, venue, 1, place, 1, physical_description, 1, occasion, 1, notes, 1, call_number, 1, keywords, 1, language, 1, date, 1, location, 1, location_type, 1, currency, 1, currency_symbol, 1, status, 1, page_count, 1, dish_count, 2, id, 2, menu_id, 2, page_number, 2, image_id, 2, full_height, 2, full_width, 2, uuid, 3, id, 3, menu_page_id, 3, price, 3, high_price, 3, dish_id, 3, created_at, 3, updated_at, 3, xpos, 3, ypos
Question: How many dishes do not have correct data for the year in which it appeared first?
Evidence: do not have correct data refers to first_appeared < 1851 or first_appeared > 2012;
SQL: SELECT COUNT(*) FROM Dish WHERE first_appeared < 1851 OR first_appeared > 2012
Database: menu
Tables: Dish, Menu, MenuPage, MenuItem
Columns (table index, column name): -1, *, 0, id, 0, name, 0, description, 0, menus_appeared, 0, times_appeared, 0, first_appeared, 0, last_appeared, 0, lowest_price, 0, highest_price, 1, id, 1, name, 1, sponsor, 1, event, 1, venue, 1, place, 1, physical_description, 1, occasion, 1, notes, 1, call_number, 1, keywords, 1, language, 1, date, 1, location, 1, location_type, 1, currency, 1, currency_symbol, 1, status, 1, page_count, 1, dish_count, 2, id, 2, menu_id, 2, page_number, 2, image_id, 2, full_height, 2, full_width, 2, uuid, 3, id, 3, menu_page_id, 3, price, 3, high_price, 3, dish_id, 3, created_at, 3, updated_at, 3, xpos, 3, ypos
Question: Which dish lasted longer, Anchovies or Fresh lobsters in every style?
Evidence: if (SUBTRACT(last_appeared, first_appeared) WHERE name = 'Anchovies') > (SUBTRACT(last_appeared, first_appeared) WHERE name = 'Fresh lobsters in every style'), it means 'Anchovies' lasted longer; if (SUBTRACT(last_appeared , first_appeared) WHERE name = 'Fresh lobsters in every style') > (SUBTRACT(last_appeared , first_appeared) WHERE name = 'Anchovies') it means 'Fresh lobsters in every style' last longer;
SQL: SELECT CASE WHEN SUM(CASE WHEN name = 'Anchovies' THEN last_appeared - first_appeared ELSE 0 END) - SUM(CASE WHEN name = 'Fresh lobsters in every style' THEN last_appeared - first_appeared ELSE 0 END) > 0 THEN 'Anchovies' ELSE 'Fresh lobsters in every style' END FROM Dish WHERE name IN ('Fresh lobsters in every style', 'Anchovies')
Database: menu
Tables: Dish, Menu, MenuPage, MenuItem
Columns (table index, column name): -1, *, 0, id, 0, name, 0, description, 0, menus_appeared, 0, times_appeared, 0, first_appeared, 0, last_appeared, 0, lowest_price, 0, highest_price, 1, id, 1, name, 1, sponsor, 1, event, 1, venue, 1, place, 1, physical_description, 1, occasion, 1, notes, 1, call_number, 1, keywords, 1, language, 1, date, 1, location, 1, location_type, 1, currency, 1, currency_symbol, 1, status, 1, page_count, 1, dish_count, 2, id, 2, menu_id, 2, page_number, 2, image_id, 2, full_height, 2, full_width, 2, uuid, 3, id, 3, menu_page_id, 3, price, 3, high_price, 3, dish_id, 3, created_at, 3, updated_at, 3, xpos, 3, ypos
Question: Among all the dishes that were once free, what is the name of the dish that had appeared on most menus?
Evidence: dishes that were once free refers to lowest_price = 0; appeared on most menus refers to MAX(menus_appeared);
SQL: SELECT name FROM Dish WHERE lowest_price = 0 ORDER BY menus_appeared DESC LIMIT 1
Database: menu
Tables: Dish, Menu, MenuPage, MenuItem
Columns (table index, column name): -1, *, 0, id, 0, name, 0, description, 0, menus_appeared, 0, times_appeared, 0, first_appeared, 0, last_appeared, 0, lowest_price, 0, highest_price, 1, id, 1, name, 1, sponsor, 1, event, 1, venue, 1, place, 1, physical_description, 1, occasion, 1, notes, 1, call_number, 1, keywords, 1, language, 1, date, 1, location, 1, location_type, 1, currency, 1, currency_symbol, 1, status, 1, page_count, 1, dish_count, 2, id, 2, menu_id, 2, page_number, 2, image_id, 2, full_height, 2, full_width, 2, uuid, 3, id, 3, menu_page_id, 3, price, 3, high_price, 3, dish_id, 3, created_at, 3, updated_at, 3, xpos, 3, ypos
Question: How many menus with the name "Waldorf Astoria" have 4 pages?
Evidence: 4 pages refers to page_count = 4;
SQL: SELECT COUNT(*) FROM Menu WHERE name = 'Waldorf Astoria' AND page_count = 4
Database: menu
Tables: Dish, Menu, MenuPage, MenuItem
Columns (table index, column name): -1, *, 0, id, 0, name, 0, description, 0, menus_appeared, 0, times_appeared, 0, first_appeared, 0, last_appeared, 0, lowest_price, 0, highest_price, 1, id, 1, name, 1, sponsor, 1, event, 1, venue, 1, place, 1, physical_description, 1, occasion, 1, notes, 1, call_number, 1, keywords, 1, language, 1, date, 1, location, 1, location_type, 1, currency, 1, currency_symbol, 1, status, 1, page_count, 1, dish_count, 2, id, 2, menu_id, 2, page_number, 2, image_id, 2, full_height, 2, full_width, 2, uuid, 3, id, 3, menu_page_id, 3, price, 3, high_price, 3, dish_id, 3, created_at, 3, updated_at, 3, xpos, 3, ypos
Question: What is the name of the dish that appeared on the upper left corner on menu page no. 1389?
Evidence: appeared on the upper left corner on menu refers to xpos < 0.25 AND ypos < 0.25; menu page no. refers to menu_page_id; menu_page_id = 1389;
SQL: SELECT T1.name FROM Dish AS T1 INNER JOIN MenuItem AS T2 ON T1.id = T2.dish_id WHERE T2.menu_page_id = 1389 AND T2.xpos < 0.25 AND T2.ypos < 0.25