db_id
stringclasses
69 values
schema
stringclasses
69 values
m_schema
stringclasses
69 values
question
stringlengths
24
325
sql
stringlengths
23
804
evidence
stringlengths
0
673
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Please indicate the product name of Tokyo Traders company with order quantity greater than 40.
SELECT DISTINCT T2.ProductName FROM Suppliers AS T1 INNER JOIN Products AS T2 ON T1.SupplierID = T2.SupplierID INNER JOIN `Order Details` AS T3 ON T2.ProductID = T3.ProductID WHERE T1.CompanyName = 'Tokyo Traders' AND T3.Quantity > 40
'Tokyo Traders' is a CompanyName; order quantity greater than 40 refers to Quantity > 40
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
List all category name of Exotic Liquids 's product with units in stock over 100.
SELECT T3.CategoryName FROM Suppliers AS T1 INNER JOIN Products AS T2 ON T1.SupplierID = T2.SupplierID INNER JOIN Categories AS T3 ON T2.CategoryID = T3.CategoryID WHERE T2.UnitsInStock > 100 AND T1.CompanyName = 'Exotic Liquids'
'Exotic Liquids' is a CompanyName; units in stock over 100 refers to UnitsInStock > 100
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many product names have order quantity less than 50? Calculate the percentage of orders less than 50 out of total order quantity.
SELECT SUM(CASE WHEN T2.Quantity < 50 THEN 1 ELSE 0 END) , CAST(SUM(IF(T2.Quantity < 50, 1, 0)) AS REAL) / COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID
order quantity less than 50 refers to Quantity < 50; Calculation = DIVIDE(SUM(Quantity < 50), SUM(ProductID)) * 100
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Please indicate total order quantity of product Geitost and calculate the percentage of such product among all the order quantity.
SELECT SUM(IF(T1.ProductName = 'Geitost', 1, 0)) AS sum , CAST(SUM(IF(T1.ProductName = 'Geitost', 1, 0)) AS REAL) / COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID
'Geitost' is a ProductName; calculation = DIVIDE(ProductName = 'Geitost', COUNT(ProductID)) * 100
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the position of Robert King?
SELECT Title FROM Employees WHERE FirstName = 'Robert' AND LastName = 'King'
'Robert King' is the full name of an employee; full name refers to FirstName, LastName; position refers to Title
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Write the shipping company name with the telephone number of (503) 555-9931.
SELECT CompanyName FROM Shippers WHERE Phone = '(503) 555-9931'
telephone number of (503) 555-9931 refers to Phone = '(503) 555-9931'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Write the address and phone number of Margaret Peacock.
SELECT Address, HomePhone FROM Employees WHERE FirstName = 'Margaret' AND LastName = 'Peacock'
Margaret Peacock is the full name of an employee; full name refers to FirstName, LastName; phone number refers to HomePhone
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the full address of Rattlesnake Canyon Grocery?
SELECT DISTINCT ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry FROM Orders WHERE ShipName = 'Rattlesnake Canyon Grocery'
full address refers to ShipAddress, ShipCity, ShipRegion,ShipPostalCode, ShipCountry; 'Rattlesnake Canyon Grocery' is a ShipName;
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
List all product names under Confections.
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.CategoryName = 'Confections'
'Confections' is a CompanyName;
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Sir Rodney's Marmalade is supplied by which company and who is the contact for this company?
SELECT T2.CompanyName, T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName LIKE 'Sir Rodney%s Marmalade'
'Sir Rodney's Marmalade' is a ProductName; company refers to CompanyName; contact for a company refers to ContactName
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the full name of the employee who is in charge of the territory of Denver?
SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T3.TerritoryDescription = 'Denver'
full name refers to FirstName, LastName; Denver is a TerritoryDescription
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
List all the territories where Laura Callahan is in charge.
SELECT T3.TerritoryDescription FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T1.FirstName = 'Laura' AND T1.LastName = 'Callahan'
territories refers to TerritoryDescription; Laura Callahan is the full name of an employee; full name refers to FirstName, LastName
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many orders were shipped via Federal Shipping?
SELECT COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Federal Shipping' AND T1.ShipVia = 3
'Federal Shipping' is a CompanyName; orders refers to OrderID
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Name the products where the suppliers come from Finland.
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'Finland'
'Finland' is a Country; product refers to ProductName; suppliers refers to SupplierID
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
The product 'Mozzarella di Giovanni' belongs in which category? Include the category's description as well.
SELECT T2.CategoryName, T2.Description FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.ProductName = 'Mozzarella di Giovanni'
Mozzarella di Giovanni' is a ProductName; category refers to CategoryName;
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Name the suppliers that supply products under the category 'cheeses.'
SELECT DISTINCT T1.CompanyName FROM Suppliers AS T1 INNER JOIN Products AS T2 ON T1.SupplierID = T2.SupplierID INNER JOIN Categories AS T3 ON T2.CategoryID = T3.CategoryID WHERE T3.Description = 'Cheeses'
suppliers refers to CompanyName; 'cheeses' is a Description
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Name all products supplied by Zaanse Snoepfabriek.
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Zaanse Snoepfabriek'
products refers to ProductName; 'Zaanse Snoepfabriek' is a CompanyName
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Which products by Plutzer Lebensmittelgromrkte AG were discontinued and what are their price?
SELECT T1.UnitPrice FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Plutzer Lebensmittelgromrkte AG' AND T1.Discontinued = 1
products refers to ProductName; 'Plutzer Lebensmittelgromrkte AG' is a CompanyName; price refers to UnitPrice; discontinued products refers to discontinued = 1
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
List the cities where the product 'Mishi Kobe Niku' were shipped to.
SELECT T1.ShipCity FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T3.ProductName = 'Mishi Kobe Niku'
cities refers to ShipCity; 'Mishi Kobe Niku' is a ProductName
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What percentage does the shipment of products by Speedy Express to Sweden make up to the shipping company's total?
SELECT CAST(COUNT(CASE WHEN T1.ShipCountry = 'Sweden' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Speedy Express'
Speedy Express is a company; Sweden is a ShipCountry; calculation = DIVIDE(SUM(ShipCountry = 'Sweden'), SEM(ShipCountry)) * 100
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many territory fall into region 1?
SELECT COUNT(TerritoryID) FROM Territories WHERE RegionID = 1
region 1 refers to RegionID = 1
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What are the the total number of territory in each region?
SELECT COUNT(TerritoryDescription) FROM Territories WHERE RegionID IN (1, 2, 3, 4) GROUP BY RegionID
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many suppliers are from UK?
SELECT COUNT(SupplierID) FROM Suppliers WHERE Country = 'UK'
from UK refers to Country = 'UK'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Please give the contact name for Tokyo Traders.
SELECT ContactName FROM Suppliers WHERE CompanyName = 'Tokyo Traders'
Tokyo Traders refers to CompanyName = 'Tokyo Traders'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many employees from USA with Sales Representative title?
SELECT COUNT(Country) FROM Employees WHERE Country = 'USA' AND Title = 'Sales Representative'
from USA refers to Country = 'USA'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What are the highest salary earn by the the employee and what is his/her position in the company?
SELECT Salary, Title FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees )
highest salary refers to max(salary); position refers to Title
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many products supplied by Plutzer Lebensmittelgromrkte AG that is currently out of stock and on order?
SELECT COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Plutzer Lebensmittelgromrkte AG' AND T1.UnitsInStock = 0 AND T1.UnitsOnOrder = 0
Plutzer Lebensmittelgromrkte AG refers to CompanyName; is currently out of stock and on order refers to UnitsInStock = 0 and UnitsOnOrder > 0
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What product have the highest unit price and how many quantity have been being sold?
SELECT T1.ProductName, T2.Quantity FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID ORDER BY T1.UnitPrice DESC LIMIT 1
product refers to ProductID; highest unit price refers to Max(UnitPrice)
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Which employee has created the least order and please indicates the employee's title?
SELECT T1.Title FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID GROUP BY T1.Title ORDER BY COUNT(T2.OrderID) LIMIT 1
least order refers to Min(OrderID)
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the most common product ordered by a customer from Germany?
SELECT T2.ProductID FROM Customers AS T1 INNER JOIN `Order Details` AS T2 WHERE T1.Country = 'Germany' GROUP BY T2.ProductID ORDER BY COUNT(T2.ProductID) DESC LIMIT 1
most common product refers to max(count(ProductID)); customer from Germany refers to Country = 'Germany'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What are the total products value shipped to Brazil by Speedy Express Company?
SELECT SUM(T2.Quantity * T2.UnitPrice) FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID INNER JOIN Shippers AS T3 ON T1.ShipVia = T3.ShipperID WHERE T3.CompanyName = 'Speedy Express' AND T1.ShipCountry = 'Brazil'
shipped to Brazil refers to ShipCountry = 'Brazil'; by Speedy Express Company refers to CompanyName = 'Speedy Express'; total products value refers to sum(MULTIPLY(UnitPrice, Quantity))
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many subordinates does employee ID 2 have and what is the biggest order in terms of value that his/her subordinates have created?
SELECT COUNT(T1.EmployeeID), SUM(T3.Quantity * T3.UnitPrice) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID WHERE T1.ReportsTo = 2 ORDER BY SUM(T3.UnitPrice * T3.Quantity) DESC LIMIT 1
subordinates of employee ID 2 refers to EmployeeID where ReportsTo = 2;  biggest order in terms of value refers to max(MULTIPLY(Quantity, UnitPrice))
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many sales values have been created by sales representative and which sales representative have the highest sales?
SELECT SUM(T3.UnitPrice * T3.Quantity) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID WHERE T1.Title = 'Sales Representative' ORDER BY SUM(T3.UnitPrice * T3.Quantity)
sales representative refers to Title = 'Sales Representative'; sales values refers to MULTIPLY(Quantity, UnitPrice); the highest sales refers to max(MULTIPLY(Quantity, UnitPrice))
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many employees is a UK citizen and are they all covering the same region?
SELECT COUNT(T1.EmployeeID), T3.RegionID FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T1.Country = 'UK' GROUP BY T3.RegionID
is a UK citizen refers to Country = 'UK'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Which customer have the biggest purchase in one order and where does this order being ship to?
SELECT T1.CompanyName, T2.ShipCountry 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, T2.ShipCountry ORDER BY COUNT(T3.ProductID) DESC LIMIT 1
biggest purchase refers to max(ProductID.Order_Details); ship to refers to ShipCountry
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Which customer is a regular customer in this shop and what are the products category that he mostly buy?
SELECT T1.CustomerID, T4.CategoryName FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID INNER JOIN Categories AS T4 ON T3.CategoryID = T4.CategoryID ORDER BY T1.CustomerID DESC, T4.CategoryName DESC
regular customer refers to max(count(CustomerID)); products category refers to CategoryName; mostly buy refers to max(count(CategoryID))
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What are the most popular confections product and calculate the total sales generated by this product?
SELECT COUNT(T1.UnitPrice * T3.Quantity) FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID INNER JOIN `Order Details` AS T3 ON T1.ProductID = T3.ProductID WHERE T2.CategoryName = 'Confections' GROUP BY T3.Quantity ORDER BY T3.Quantity DESC LIMIT 1
most popular confections product refers to ProductID = max(count(MULTIPLY(Quantity, UnitPrice))) from CategoryName = 'Confections' ;  total sales refers to sum(MULTIPLY(Quantity, UnitPrice))
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the name of product with the ID of 77?
SELECT ProductName FROM Products WHERE ProductID = 77
name of product refers to ProductName; ID refers to ProductID
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
State the company name of all suppliers in USA.
SELECT CompanyName FROM Suppliers WHERE Country = 'USA'
in USA refers to Country = 'USA'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the position title for Laura Callahan?
SELECT Title FROM Employees WHERE FirstName = 'Laura' AND LastName = 'Callahan'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
State the name of employee that manages the order from Victuailles en stock?
SELECT DISTINCT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Customers AS T3 ON T2.CustomerID = T3.CustomerID WHERE T3.CompanyName = 'Victuailles en stock'
name of employee refers to FirstName; from Victuailles en stock refers to CompanyName = 'Victuailles en stock'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many orders were shipped by Federal Shipping?
SELECT COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Federal Shipping'
Federal Shipping refers to CompanyName = 'Federal Shipping'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Who was taking charge of orders from Morristown?
SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID WHERE T3.TerritoryDescription = 'Morristown'
Morristown refers to TerritoryDescription = 'Morristown'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
State the name of all territories in Northern region.
SELECT DISTINCT T1.TerritoryDescription FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Northern'
name of all territories refers to TerritoryDescription; Northern region refers to RegionDescription = 'Northern'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many orders were handled by Michael Suyama. State the order ID.
SELECT COUNT(T2.OrderID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Michael' AND T1.LastName = 'Suyama'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the ratio number of territories in Northern region and number territories in Western region?
SELECT CAST(( SELECT COUNT(T1.TerritoryID) FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Northern' ) AS REAL) * 100 / ( SELECT COUNT(T1.TerritoryID) FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Weste...
Northern region refers to RegionID = 3; Western region refers to RegionID = 2 ; ratio = divide((TerritoryDescription where RegionID = 3), (TerritoryDescription where RegionID = 2))
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Provide employees' ID who are in-charge of territory ID from 1000 to 2000.
SELECT EmployeeID FROM EmployeeTerritories WHERE TerritoryID BETWEEN 1000 AND 2000
territory ID from 1000 to 2000 refers to TerritoryID BETWEEN 1000 and 2000
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
List down the territory IDs, descriptions and region description which are under the in-charge of Nancy Davolio,
SELECT T3.RegionID, T3.TerritoryDescription, T4.RegionDescription FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID INNER JOIN Region AS T4 ON T3.RegionID = T4.RegionID WHERE T1.LastName = 'Davolio' AND T1.FirstName...
descriptions refers to TerritoryDescription; region refers to RegionDescription
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Describe Sales Representative names who were hired in 1992 and compare the number of orders among them.
SELECT T1.FirstName, T1.LastName, COUNT(T2.OrderID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.Title = 'Sales Representative' AND STRFTIME('%Y', T1.HireDate) = '1992' GROUP BY T1.EmployeeID, T1.FirstName, T1.LastName
Sales Representative refers to Title = 'Sales Representative';were hired in 1992 refers to HireDate = '1992'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Calculate the total payment of orders for Vegie-spread product.
SELECT SUM(T2.UnitPrice * T2.Quantity * (1 - T2.Discount)) AS sum FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductName = 'Vegie-spread'
Vegie-spread product refers to ProductName = 'Vegie-spread';total payment = MULTIPLY(UnitPrice, Quantity, (1-Discount))
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
List down the company names which supplied products for the order on 14th August, 1996.
SELECT T1.CompanyName FROM Suppliers AS T1 INNER JOIN Products AS T2 ON T1.SupplierID = T2.SupplierID INNER JOIN `Order Details` AS T3 ON T2.ProductID = T3.ProductID INNER JOIN Orders AS T4 ON T3.OrderID = T4.OrderID WHERE date(T4.OrderDate) = '1996-08-14'
products refers to Order_Details.ProductID; on 14th August, 1996 refers to OrderDate = '8/14/1996'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Among the product lists in order ID 10337, write down the product names and suppliers which had the highest in reorder level.
SELECT T2.ProductName, T1.CompanyName FROM Suppliers AS T1 INNER JOIN Products AS T2 ON T1.SupplierID = T2.SupplierID INNER JOIN `Order Details` AS T3 ON T2.ProductID = T3.ProductID WHERE T3.OrderID = 10337 ORDER BY T2.ReorderLevel DESC LIMIT 1
suppliers refers to CompanyName; highest in reorder level refers to Max(ReorderLevel)
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Name the shipper which had the most shipments in first quarter of 1998.
SELECT T1.CompanyName FROM Shippers AS T1 INNER JOIN Orders AS T2 ON T1.ShipperID = T2.ShipVia WHERE STRFTIME('%Y', T2.ShippedDate) = '1998' GROUP BY T1.CompanyName ORDER BY COUNT(T2.OrderID) DESC LIMIT 1
Name the shipper refers to CompanyName; most shipments refers to max(count(OrderID)); first quarter of 1998 refers to ShippedDate = 1998/1 and ShippedDate = 1998/2 and ShippedDate = 1998/3 and ShippedDate = 1998/4
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many customers are located in London?
SELECT COUNT(CustomerID) FROM Customers WHERE City = 'London'
London refers to City = 'London'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the title of Michael Suyama?
SELECT Title FROM Employees WHERE FirstName = 'Michael' AND LastName = 'Suyama'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
List out the full name of employee who has birth day on "3/4/1955 12:00:00 AM".
SELECT FirstName, LastName FROM Employees WHERE BirthDate = '1955-03-04 00:00:00'
full name refers to FirstName, LastName; brith day refers to BirthDate
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Mention the first name of employee who took care the order id 10250.
SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10250
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many orders that the employees who are located in Tacoma handled?
SELECT COUNT(T2.OrderID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.City = 'Tacoma'
located in Tacoma refers to City = 'Tacoma'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the country location of the employee who handled order id 10257?
SELECT T1.Country FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10257
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the title of the employee who handled order id 10270?
SELECT T1.Title FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10257
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Give the phone number of the customer who placed the order id 10264.
SELECT T1.Phone FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.OrderID = 10264
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the region where the customer who placed the order id 10276 located?
SELECT T1.Region FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.OrderID = 10276
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Among the employees who handled orders to Brazil, who has the highest salary and calculate the average salary of them.
SELECT T1.FirstName, T1.LastName, AVG(T1.Salary) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.ShipCountry = 'Brazil' GROUP BY T1.FirstName, T1.LastName ORDER BY SUM(T1.Salary) DESC LIMIT 1
orders to Brazil refers to ShipCountry = 'Brazil'; highest salary refers to max(salary); average salary = AVG(Salary)
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Calculate the percentage salary of employees who handled orders shipped in 1996.
SELECT CAST(SUM(CASE WHEN STRFTIME('%Y', T2.ShippedDate) = '1996' THEN T1.Salary ELSE 0 END) AS REAL) * 100 / SUM(T1.Salary) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID
shipped in 1996 refers to ShippedDate = 1996; percentage salary = divide(sum(Salary when ShippedDate = 1996), sum(Salary)) as percentage
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
When was the employee who handled order id 10281 hired?
SELECT T1.HireDate FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10281
When was hired refers to HireDate
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many orders was handled by employees who reported to employee id 5?
SELECT COUNT(T2.OrderID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.ReportsTo = 5
reported to employee id 5 refers to ReportsTo = 5
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Give the full name of employee who handled the order id 10280.
SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10280
full name refers to FirstName, LastName
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
State the shipping company of order id 10260.
SELECT T2.CompanyName FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.OrderID = 10260
shipping company refers to CompanyName
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many orders have been shipped through United Package?
SELECT COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'United Package'
shipped through refers to ShipVia; United Package refers to CompanyName = 'United Package'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
List out the phone number of the shipping company of order id 10296.
SELECT T2.Phone FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.OrderID = 10260
shipping company refers to Shippers; phone number refers to Phone
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
How many kinds of items are returned in order no.5?
SELECT COUNT(l_linenumber) FROM lineitem WHERE l_orderkey = 5 AND l_returnflag = 'R'
returned refer to l_returnflag = 'R'; order no.5 refers to l_orderkey = 5; kinds of items refer to l_linenumber;
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
When was the latest date the items of order no.1 were shipped?
SELECT MAX(l_shipdate) FROM lineitem WHERE l_orderkey = 1
order no.1 refers to l_orderkey = 1; the latest date shipped refers to MAX(l_shipdate);
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Which order has a higher priority, order no. 4 or order no. 36?
SELECT l_orderkey FROM lineitem WHERE l_orderkey IN (4, 36) ORDER BY l_shipdate DESC LIMIT 1
earlier orderdate have higher priority in delivery; which order no. 4 or order no. 36 refers to o_orderkey in (4, 36) where MIN(o_orderdate);
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
What is the comment of the order with the highest total price?
SELECT o_comment FROM orders WHERE o_totalprice = ( SELECT MAX(o_totalprice) FROM orders )
the highest total price refers to MAX(o_totalprice); comment of the order refers to o_comment;
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
What is the phone number of Customer#000000001?
SELECT c_phone FROM customer WHERE c_name = 'Customer#000000001'
customer phone refers to c_phone; Customer#000000001 refers to c_name;
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
How many orders in total have the customers in the household segment made?
SELECT COUNT(T1.o_orderkey) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'HOUSEHOLD'
orders in household segment refer to o_orderkey where c_mktsegment = 'HOUSEHOLD';
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Among all the orders made by a customer in the household segment, what is the highest total price?
SELECT MAX(T1.o_totalprice) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'HOUSEHOLD'
orders in household segment refer to o_orderkey where c_mktsegment = 'HOUSEHOLD'; the highest total price refers to MAX(o_totalprice);
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Please list the order comments of all the orders made by customers in the household segment.
SELECT T1.o_comment FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'HOUSEHOLD'
orders in household segment refer to o_orderkey where c_mktsegment = 'HOUSEHOLD'; order comments refer to o_comment;
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Please give the name of the customer who has made the single order with the highest total price.
SELECT T2.c_name FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey ORDER BY T1.o_totalprice DESC LIMIT 1
name of the customer refers to c_name; single order with the highest total price refers to MAX(o_totalprice) LIMIT 1;
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Please list the order keys of all the orders made by a customer whose account is in debt.
SELECT T1.o_orderkey FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_acctbal < 0
account is in debt if c_acctbal < 0;
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Among the orders made by customers in the household segment, how many of them are urgent?
SELECT COUNT(T1.o_orderpriority) FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T2.c_mktsegment = 'HOUSEHOLD' AND T1.o_orderpriority = '1-URGENT'
orders in household segment refer to o_orderkey where c_mktsegment = 'HOUSEHOLD'; the order is urgent if o_orderpriority = '1-URGENT' ;
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
How many customers are in Brazil?
SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'BRAZIL'
Brazil is the name of the nation which refers to n_name = 'BRAZIL'
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Please list the phone numbers of all the customers in the household segment and are in Brazil.
SELECT T1.c_phone FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_mktsegment = 'HOUSEHOLD' AND T2.n_name = 'BRAZIL'
phone numbers refer to c_phone; Brazil is the name of the nation which refers to n_name = 'BRAZIL'; household segment refers to c_mktsegment = 'HOUSEHOLD';
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Among all the customers in Germany, how many of them have an account balance of over 1000?
SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'GERMANY' AND T1.c_acctbal > 1000
Germany is the name of the nation which refers to n_name = 'GERMANY'; account balance of over 1000 refers to c_acctbal > 1000;
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
How many orders in total are made by customers in Germany?
SELECT COUNT(T2.c_custkey) FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN orders AS T3 ON T2.c_custkey = T3.o_custkey WHERE T1.n_name = 'GERMANY'
orders refer to o_orderkey; Germany is the name of the nation which refers to n_name = 'GERMANY';
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
What is the total price of all the orders made by customers in Germany?
SELECT SUM(T3.o_totalprice) FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN orders AS T3 ON T2.c_custkey = T3.o_custkey WHERE T1.n_name = 'GERMANY'
orders refer to o_orderkey; total price refers to o_totalprice; Germany is the name of the nation which refers to n_name = 'GERMANY';
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Among the orders made by customers in Germany, which one of them has the highest priority in delivery? Please give its order key.
SELECT T3.o_orderkey FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN orders AS T3 ON T2.c_custkey = T3.o_custkey WHERE T1.n_name = 'GERMANY' ORDER BY T3.o_orderdate LIMIT 1
orders refer to o_orderkey; Germany is the name of the nation which refers to n_name = 'GERMANY'; earlier orderdate have higher priority in delivery therefore MIN(o_orderdate);
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
What is the average price of the orders made by a customer in Germany?
SELECT AVG(T3.o_totalprice) FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN orders AS T3 ON T2.c_custkey = T3.o_custkey WHERE T1.n_name = 'GERMANY'
DIVIDE(SUM(o_totalprice), COUNT(o_orderkey)) where n_name = 'GERMANY';
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Among all the customers, what is the percentage of the customer's nation being Germany?
SELECT CAST(SUM(IIF(T2.n_name = 'GERMANY', 1, 0)) AS REAL) * 100 / COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey
DIVIDE(COUNT(c_custkey when n_name = 'GERMANY'), COUNT(c_custkey)) as percentage;
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
How many countries are there in the No.2 region?
SELECT COUNT(n_nationkey) FROM nation WHERE n_regionkey = 2
No.2 region refers to n_regionkey = 2;
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Which country does supplier No.34 come from?
SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_suppkey = 34
supplier No.34 refers to s_suppkey = 34; country refers to n_name;
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Which region does "Supplier#000000129" belong to?
SELECT T3.r_name FROM nation AS T1 INNER JOIN supplier AS T2 ON T1.n_nationkey = T2.s_nationkey INNER JOIN region AS T3 ON T1.n_regionkey = T3.r_regionkey WHERE T2.s_name = 'Supplier#000000129'
"Supplier#000000129" is the name of the supplier which refers to s_name; Which region refers to r_name;
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
What is the nationality of "Customer#000000055"?
SELECT T2.n_name FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_name = 'Customer#000000055'
"Customer#000000055" is the name of the customer which refers to c_name; nationality is the state of belonging to a particular country, therefore nationality refers to n_name;
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Give customer No.106936's region name.
SELECT T3.r_name FROM nation AS T1 INNER JOIN customer AS T2 ON T1.n_nationkey = T2.c_nationkey INNER JOIN region AS T3 ON T1.n_regionkey = T3.r_regionkey WHERE T2.c_custkey = 106936
"Customer#000000055" is the name of the customer which refers to c_name; region name refers to r_name;
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Give the number of Moroccan customers whose account is in debt.
SELECT COUNT(T1.c_name) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T2.n_name = 'MOROCCO' AND T1.c_acctbal < 0
account is in debt if c_acctbal < 0; Moroccan customers refer to c_name WHERE n_name = 'MOROCCO';
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
For the order with the total price of 231499.38, what was the discounted price for supplier No. 9397?
SELECT T1.l_extendedprice * (1 - T1.l_discount) AS DISCOUNTERPRICE FROM lineitem AS T1 INNER JOIN orders AS T2 ON T2.o_orderkey = T1.l_orderkey WHERE T1.l_suppkey = 9397 AND T2.o_totalprice = 231499.38
MULTIPLY(l_extendedprice, SUBTRACT(1, l_discount)) where o_totalprice = 231499.38 AND l_suppkey = 9397;
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
For the order with the total price of 218195.43, which supplier handled the returned item? Give the supplier id.
SELECT T2.l_suppkey FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_totalprice = 218195.43 AND T2.l_returnflag = 'R'
returned item refers to l_returnflag = 'R'; supplier id refers to l_suppkey; order with the total price of 218195.43 refers to o_totalprice = 218195.43;
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Clerk#000000936 dealt with a "Not Specified" order on 1995/3/13, what was the charge for the part of the order shipped by truck?
SELECT T2.l_extendedprice * (1 - T2.l_discount) * (1 + T2.l_tax) AS num FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_clerk = 'Clerk#000000936' AND T2.l_shipmode = 'TRUCK' AND T1.o_orderstatus = '4-NOT SPECIFIED' AND T1.o_orderdate = '1995-03-13'
MULTIPLY(MULTIPLY(l_extendedprice, SUBTRACT(1, l_discount)), SUM(1, l_tax)) WHERE o_clerk = 'Clerk#000000936', o_orderstatus = '4-NOT SPECIFIED', o_orderdate = '1995-03-13' AND l_shipmode = 'TRUCK';
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Customer No.129301 made an order on 1996/7/27, what was the delivery time for the first part of that order?
SELECT JULIANDAY(T2.l_receiptdate) - JULIANDAY(T2.l_commitdate) FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey WHERE T1.o_custkey = '129301' AND T1.o_orderdate = '1996-07-27'
SUBTRACT(l_receiptdate, l_commitdate) WHERE o_orderdate = '1996-07-27' AND o_custkey = '129301';
retails
CREATE TABLE `customer` ( `c_custkey` INTEGER NOT NULL, `c_mktsegment` TEXT DEFAULT NULL, `c_nationkey` INTEGER DEFAULT NULL, `c_name` TEXT DEFAULT NULL, `c_address` TEXT DEFAULT NULL, `c_phone` TEXT DEFAULT NULL, `c_acctbal` REAL DEFAULT NULL, `c_comment` TEXT DEFAULT NULL, PRIMARY KEY (`c_custkey`),...
【DB_ID】 retails 【Schema】 # Table: main.customer [ (c_custkey:INTEGER, Primary Key, Examples: [1, 2, 3]), (c_mktsegment:TEXT, Examples: [BUILDING, MACHINERY, FURNITURE]), (c_nationkey:INTEGER, Examples: [8, 16, 11]), (c_name:TEXT, Examples: [Customer#000000001, Customer#000000002, Customer#000000003]), (c_address:TEXT, ...
Give the name of the customer who made an order with Clerk#000000803 on 1997/12/10.
SELECT T2.c_name FROM orders AS T1 INNER JOIN customer AS T2 ON T1.o_custkey = T2.c_custkey WHERE T1.o_orderdate = '1997-12-10' AND T1.o_clerk = 'Clerk#000000803'
name of the customer refers to c_name; o_clerk = 'Clerk#000000803'; order on 1997/12/10 refers to o_orderdate = '1997-12-10';