1sf/bird-sql-train-with-schema huggingface dataset:
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: Please list the full names and titles of all employees.
Evidence: full name refers to LastName, FirstName
SQL: SELECT FirstName, LastName, Title FROM Employees
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: Who has the highest salary? Please give their first name.
Evidence: highest salary refers to Max(Salary)
SQL: SELECT FirstName, LastName FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees )
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: How many sales representatives whose salaries are higher than 2000?
Evidence: "Sales Representative" is the Title; higher than 2000 refers to Salary > 2000
SQL: SELECT COUNT(Title) FROM Employees WHERE Salary > 2000 AND Title = 'Sales Representative'
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: In 1996, how many orders were from customers in the UK?
Evidence: in 1996 refers to YEAR (OrderDate) = 1996; 'UK' is the Country;
SQL: SELECT COUNT(T1.CustomerID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1996' AND T1.Country = 'UK'
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: Which company had the most orders in 1998?
Evidence: in 1998 refers to YEAR (OrderDate) = 1998; most orders = Max(Count(CustomerID)); company refers to CompanyName
SQL: SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1998' GROUP BY T1.CompanyName ORDER BY COUNT(T2.OrderID) DESC LIMIT 1
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: Please calculate the number of orders from customers by country in 1996.
Evidence: in 1996 refer to YEAR(OrderDate) = 1996; number of order = Count(OrderID)
SQL: SELECT COUNT(T2.CustomerID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1996' GROUP BY T1.Country
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: How many orders were from Hanna Moos company in 1999?
Evidence: "Hanna Moos" is the CompanyName; in 1999 refer to YEAR (OrderDate) = 1999
SQL: SELECT COUNT(T2.OrderID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1999' AND T1.CompanyName = 'Hanna Moos'
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: How many days was the fastest shipping of Berglunds snabbkp's order?
Evidence: Berglunds snabbkp is the CompanyName; fastest shipping = Min(Subtract(ShippedDate, OrderDate))
SQL: SELECT datediff(T2.ShippedDate, T2.OrderDate) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.CompanyName = 'Berglunds snabbkp' ORDER BY datediff(T2.ShippedDate, T2.OrderDate) LIMIT 1
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: Which company placed the order with the id 10257?
Evidence: "10257" is the OrderID; company refers to CompanyName
SQL: SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.OrderID = 10257
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: In which year did Around the Horn place the most orders?
Evidence: Around the Horn is the CompanyName; year with the most order refers to Year (OrderDate) where Max(Count(OrderID))
SQL: SELECT STRFTIME('%Y', T2.OrderDate) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.CompanyName = 'Around the Horn' GROUP BY STRFTIME('%Y', T2.OrderDate) ORDER BY COUNT(T2.OrderID) DESC LIMIT 1
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: How many employees report to Andrew Fuller?
Evidence: "Andrew Fuller" refers to FirstName = 'Andrew' AND LastName = 'Fuller'; report to refers to ReportsTo ! = NULL
SQL: SELECT COUNT(EmployeeID) FROM Employees WHERE ReportsTo = ( SELECT EmployeeID FROM Employees WHERE LastName = 'Fuller' AND FirstName = 'Andrew' )
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: Which country are the majority of the suppliers located?
Evidence: majority of the suppliers located refers to MAX(COUNT(SupplierID))
SQL: SELECT Country FROM Suppliers GROUP BY Country ORDER BY COUNT(SupplierID) DESC LIMIT 1
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: What is the full name of the employees who report to the Sales Manager?
Evidence: full name refers to LastName, FirstName; the Sales Manager refers to Title = 'Sales Manager'; report to refers to ReportsTo is not NULL;
SQL: SELECT FirstName, LastName FROM Employees WHERE ReportsTo = ( SELECT EmployeeID FROM Employees WHERE Title = 'Sales Manager' )
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: In August of 1996, how many orders were placed by the customer with the highest amount of orders?
Evidence: August of 1996 refers to OrderDate = '1996-8'; highest amount of orders refers to MAX(COUNT(OrderID))
SQL: SELECT COUNT(OrderID) FROM Orders WHERE OrderDate LIKE '1996-08%' GROUP BY CustomerID ORDER BY COUNT(OrderID) DESC LIMIT 1
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: How much is the salary of the first employee that was hired?
Evidence: first employee that was hired refers to MIN(HireDate)
SQL: SELECT Salary FROM Employees WHERE HireDate = ( SELECT MIN(HireDate) FROM Employees )
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: How old was the oldest employee at the time he or she was hired?
Evidence: oldest employee at the time he or she was hired refers to MAX(SUBTRACT(HireDate, Birthdate))
SQL: SELECT MAX(TIMESTAMPDIFF(YEAR, BirthDate, HireDate)) FROM Employees
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: What is the total sales amount of all discontinued products?
Evidence: discontinued products refers to Discontinued = 1; total sales amount refers to SUM(MULTIPLY(UnitPrice, Quantity))
SQL: SELECT SUM(T2.UnitPrice * T2.Quantity) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Discontinued = 1
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: What is the category of the product that has the highest number of discontinued products?
Evidence: discontinued products refers to Discontinued = 1; highest number of discontinued products refers to MAX(Discontinued = 1)
SQL: SELECT T2.CategoryName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.Discontinued = 1 GROUP BY T2.CategoryName ORDER BY COUNT(T1.ProductID) DESC LIMIT 1
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: How many condiments were sold in 1997?
Evidence: "Condiments" is the CategoryName; in 1997 refers to year(OrderDate) = 1997;
SQL: SELECT COUNT(T2.ProductID) FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID INNER JOIN `Order Details` AS T3 ON T2.ProductID = T3.ProductID INNER JOIN Orders AS T4 ON T3.OrderID = T4.OrderID WHERE T1.CategoryName = 'Condiments' AND T1.CategoryID = 2 AND T4.OrderDate LIKE '1997%'
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: Who is the customer who purchased the highest number of products in a single order?
Evidence: highest number of products refers to MAX(COUNT(ProductID))
SQL: SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID GROUP BY T1.CompanyName ORDER BY COUNT(T3.ProductID) DESC LIMIT 1
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: What is the monthly average number of products shipped via Federal Shipping for the year 1996?
Evidence: monthly average number of products refers to DIVIDE(SUM(OrderID), 12); shipped via Federal Shipping refers to CompanyName = 'Federal Shipping'; for the year 1996 refers to year(ShippedDate) = 1996
SQL: SELECT CAST(SUM(T1.ShipVia) AS REAL) / 12 FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Federal Shipping' AND T1.ShippedDate LIKE '1996%'
Database: retail_world
Tables: Categories, Customers, Employees, Shippers, Suppliers, Products, Orders, OrderDetails
Columns (table index, column name): -1, *, 0, CategoryID, 0, CategoryName, 0, Description, 1, CustomerID, 1, CustomerName, 1, ContactName, 1, Address, 1, City, 1, PostalCode, 1, Country, 2, EmployeeID, 2, LastName, 2, FirstName, 2, BirthDate, 2, Photo, 2, Notes, 3, ShipperID, 3, ShipperName, 3, Phone, 4, SupplierID, 4, SupplierName, 4, ContactName, 4, Address, 4, City, 4, PostalCode, 4, Country, 4, Phone, 5, ProductID, 5, ProductName, 5, SupplierID, 5, CategoryID, 5, Unit, 5, Price, 6, OrderID, 6, CustomerID, 6, EmployeeID, 6, OrderDate, 6, ShipperID, 7, OrderDetailID, 7, OrderID, 7, ProductID, 7, Quantity
Question: Which products are being supplied by "G'day, Mate"? List all of their names.
Evidence: supplied by "G'day, Mate" refers to CompanyName = 'G''day, Mate';
SQL: SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName LIKE 'G%day, Mate'