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: What is the average salary for employees from ID 1 to 9?
Evidence: ID 1 to 9 refers to EmployeeID BETWEEN 1 AND 9; Average salary = AVG(Salary)
SQL: SELECT AVG(Salary) FROM Employees WHERE EmployeeID BETWEEN 1 AND 9
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: Calculate the total salary for employees from UK.
Evidence: "UK" is the Country; total salary refers to Sum(Salary)
SQL: SELECT SUM(Salary) FROM Employees WHERE 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: Is (206) 555-1189 the home phone number for Laura Callahan?
Evidence: "Laura Callahan" refers to FirstName = 'Laura AND LastName = 'Callahan
SQL: SELECT CASE WHEN HomePhone = '(206) 555-1189' THEN 'YES' ELSE 'NO' END FROM Employees WHERE FirstName = 'Laura' AND LastName = 'Callahan'
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: Write down the notes of employee with the highest salary.
Evidence: highest salary refers to Max(Salary)
SQL: SELECT Notes 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: List down the customer ids who placed order with Michael Suyama.
SQL: SELECT T2.CustomerID FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Michael' AND T1.LastName = 'Suyama'
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: Where are the ship countries of orders placed by Janet Leverling?
SQL: SELECT DISTINCT T2.ShipCountry FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Janet' AND T1.LastName = 'Leverling'
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 have Margaret Peacock placed?
SQL: SELECT COUNT(T2.EmployeeID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Margaret' AND T1.LastName = 'Peacock'
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: Calculate the average salary per order for Andrew Fuller.
Evidence: average salary = AVG(Salary)
SQL: SELECT CAST(SUM(T1.Salary) AS REAL) / COUNT(T2.EmployeeID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Andrew' AND T1.LastName = 'Fuller'
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 are the product names of Exotic Liquids?
Evidence: "Exotic Liquids" is the CompanyName
SQL: SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Exotic Liquids'
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: List down the quantity per unit for products of Tokyo Traders.
Evidence: "Tokyo Traders" is the CompanyName
SQL: SELECT T1.QuantityPerUnit FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Tokyo Traders'
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 products have been discountinued by New Orleans Cajun Delights?
Evidence: "New Orleans Cajun Delights" is the CompanyName; discontinued refers to Discontinued = 1
SQL: SELECT COUNT(T1.Discontinued) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'New Orleans Cajun Delights'
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 average unit price for products of Formaggi Fortini s.r.l.
Evidence: "Formaggi Fortini s.r.l." is the CompanyName; average unit price = AVG(UnitPrice)
SQL: SELECT SUM(T1.UnitPrice) / COUNT(T1.SupplierID) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Formaggi Fortini s.r.l.'
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: Calculate the total products that are supplied by Japan suppliers.
Evidence: Japan Supplier refers to Country = 'Japan'; total product refers to Count (ProductName)
SQL: SELECT COUNT(T1.SupplierID) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'Japan'
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 contact name for product Teatime Chocolate Biscuits?
Evidence: "Teatime Chocolate Biscuits" is the ProductName
SQL: SELECT T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Teatime Chocolate Biscuits'
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: List down the company names that have the highest reorder level.
Evidence: Highest reorder level refers to Max(ReorderLevel)
SQL: SELECT DISTINCT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ReorderLevel = ( SELECT MAX(ReorderLevel) FROM Products )
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 contact title for the person who supplied a product that is 10 boxes x 12 pieces.
Evidence: "10 boxes x 12 pieces" is the QuantityPerUnit
SQL: SELECT T2.ContactTitle FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.QuantityPerUnit = '10 boxes x 12 pieces'
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 units on order from Exotic Liquids?
Evidence: "Exotic Liquids" is the CompanyName; total unit on order = Sum(UnitsOnOrder)
SQL: SELECT SUM(T1.UnitsOnOrder) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Exotic Liquids'
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: Calculate the percentage of products supplied by Gai pturage over all products.
Evidence: "Gai pturage" is the CompanyName; Percentage = Divide (Count(SupplierID where CompanyName = 'Gai pturage'), Count (SupplierID)) * 100
SQL: SELECT CAST(COUNT(CASE WHEN T2.CompanyName = 'Gai pturage' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.SupplierID) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID
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: List the product ID of the top five products, by descending order, the number of quantities in stock.
Evidence: by descending in number of quantity in stock refers to max(UnitsInStock)
SQL: SELECT ProductID FROM Products ORDER BY UnitsInStock DESC LIMIT 5
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: Among the products, how many of them were discontinued in production?
Evidence: discontinued refers to Discontinued = 1
SQL: SELECT COUNT(*) FROM Products WHERE 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: Give me the address, home phone and salary of the Sales Manager.
Evidence: "Sales Manage" is the Title
SQL: SELECT Address, HomePhone, Salary 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: What is the full name of the Vice President of Sales. Give me the URL of his/her photo.
Evidence: "Vice Present of Sales" refers to Title = 'Vice President, Sales'; full name refers to FirstName, LastName; url of photo refers to PhotoPath
SQL: SELECT FirstName, LastName FROM Employees WHERE Title = 'Vice President, Sales'
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: Write down the top ten companies with the most total sales by amount.
Evidence: most total sales refers to Max(SaleAmount); companies refers to CompanyName
SQL: SELECT CompanyName FROM `Sales Totals by Amount` ORDER BY SaleAmount DESC LIMIT 10
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 average sales for each categories?
Evidence: average sales = AVG(ProductSales)
SQL: SELECT AVG(ProductSales) FROM `Sales by Category` GROUP BY CategoryName