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...
Calculate the percentage of shipping done through Speedy Express.
SELECT CAST(COUNT(CASE WHEN T2.CompanyName = 'Speedy Express' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.ShipVia) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID
through Speedy Express refers to CompanyName = 'Speedy Express'; percentage = divide(count(ShipperID where CompanyName = 'Speedy Express') , count(ShipperID)) * 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...
Indicate the courtesy title of the 3 employees who have the lowest salary.
SELECT TitleOfCourtesy FROM Employees ORDER BY Salary LIMIT 3
courtesy title refers to TitleOfCourtesy; the lowest salary refers to MIN(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...
What is the last name of the employees who must report to the Vice President of Sales?
SELECT LastName FROM Employees WHERE ReportsTo = ( SELECT EmployeeID FROM Employees WHERE Title = 'Vice President, Sales' )
report to represents a hierarchical relationship where the person being reported to is usually the direct supervisor of the reporter; Vice President of Sales refers to Title = 'Vice President, Sales';
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 highest total price paid for an order?
SELECT UnitPrice * Quantity * (1 - Discount) AS THETOP FROM `Order Details` ORDER BY UnitPrice * Quantity * (1 - Discount) DESC LIMIT 1
the highest total price paid for an order can be calculated as MAX(MULTIPLY(UnitPrice, Quantity, SUBTRACT(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...
Which 3 products are produced in greater quantity?
SELECT ProductName FROM Products ORDER BY UnitsInStock + UnitsOnOrder DESC LIMIT 3
3 products produced in greater quantity refer to MAX(SUM(UnitsInStock, UnitsOnOrder)) Limit 3;
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...
Of the 10 products with the highest unit price, identify by their ID the ones that have generated the least satisfaction.
SELECT ProductID FROM Products ORDER BY ReorderLevel ASC, UnitPrice DESC LIMIT 1
High reorder level generally means high user satisfaction of the product and vice versa; the least satisfaction refers to MIN(ReorderLevel); the 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...
How many non-discontinued products are there in the dairy category?
SELECT COUNT(T1.CategoryID) FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.CategoryName = 'Dairy Products' AND T2.Discontinued = 0
non-discontinued products in the dairy category refer to ProductID where Discontinued = 0 and CategoryName = 'Dairy Products';
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 territories is the Inside Sales Coordinator in charge of?
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.Title = 'Inside Sales Coordinator'
territories refer to TerritoryDescription; Title = 'Inside Sales Coordinator';
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...
Indicate the name of the companies that have freighted products for a value greater than 2,000,000.
SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Freight > 2000000
freighted products for a value greater than 2,000,000 refer to Freight > 2000000; name of companies 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...
Through which companies have products been shipped the most times to the city of Aachen?
SELECT T2.CompanyName FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.ShipCity = 'Aachen' GROUP BY T2.CompanyName ORDER BY COUNT(T1.ShipVia) DESC LIMIT 1
shipped the most times refer to MAX(COUNT(ShipVia)); city of Aachen refers to ShipCity = 'Aache'; companies 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...
List the full name of all employees who work in the Northern region.
SELECT DISTINCT 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 INNER JOIN Region AS T4 ON T3.RegionID = T4.RegionID WHERE T4.RegionDescription = 'Northern'
full names = FirstName, LastName; 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...
What is the name of the contact person of the Pavlova supplier company?
SELECT T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Pavlova'
contact person refers to ContactName; Pavlova is the name of the product;
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...
Indicate the name of the products that have been shipped to the city of Paris.
SELECT T3.ProductName 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 T1.ShipCity = 'Paris'
shipped to the city of Paris refers to ShipCity = 'Paris';
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 is the least shipped to the postal code 28023?
SELECT T4.ProductName 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 INNER JOIN Products AS T4 ON T3.ProductID = T4.ProductID WHERE T1.PostalCode = 28023 ORDER BY T3.Quantity LIMIT 1
the least shipped product refers ProductName where MIN(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...
What is the full name of the employee in charge of the Southern region who is to report to Andrew Fuller?
SELECT DISTINCT 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 INNER JOIN Region AS T4 ON T3.RegionID = T4.RegionID WHERE T4.RegionDescription = 'Southern' AND T1.ReportsTo = ( SELECT Em...
full names = FirstName, LastName; report to represents a hierarchical relationship where the person being reported to is usually the direct supervisor of the reporter; Andrew Fuller refers to Employees WHERE FirstName = 'Andrew' AND LastName = 'Fuller'; Southern region refers to RegionDescription = 'Southern';
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...
On what date did the Du monde entier company request that 9 units of Filo Mix be sent to it?
SELECT T2.OrderDate 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 INNER JOIN Products AS T4 ON T3.ProductID = T4.ProductID WHERE T4.ProductName = 'Filo Mix' AND T3.Quantity = 9 AND T1.CompanyName = 'Du monde entier'
9 units of Filo Mix refer to ProductName where Quantity = 9; Du monde entier is the name of the customer; date refers to OrderDate;
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...
Indicate the name of the categories to which the products of order number 10933 belong.
SELECT T3.CategoryName FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Categories AS T3 ON T1.CategoryID = T3.CategoryID WHERE T2.OrderID = 10933
order number 10933 refers to OrderID = 10933;
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 phone number for the employee in charge of the Portsmouth territory?
SELECT T1.HomePhone 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 = 'Portsmouth'
phone refers to HomePhone; Portsmouth territory refers to TerritoryDescription = 'Portsmouth';
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 average quantity of product that have been shipped by Federal Shipping in November 1996?
SELECT CAST(SUM(T2.Quantity) AS REAL) / COUNT(T2.OrderID) 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 T1.ShippedDate LIKE '1996-11%' AND T3.CompanyName = 'Federal Shipping'
Federal Shipping refers to CompanyName = 'Federal Shipping'; DIVIDE(SUM(Quantity), COUNT(ProductID)) where CompanyName = 'Federal Shipping' and ShippedDate > = '1996-11-01 00:00:00' AND ShippedDate < '1996-12-01 00:00:00';
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...
Of all the shipments made by United Package throughout the year 1996, what percentage correspond to the month of September?
SELECT CAST(COUNT(CASE WHEN T1.ShippedDate LIKE '1996-09%' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.ShipVia) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'United Package' AND T1.ShippedDate LIKE '1996%'
DIVIDE(COUNT(OrderID where CompanyName = 'United Package' and ShippedDate > = '1996-09-01 00:00:00' AND ShippedDate < '1996-09-30 00:00:00')), (COUNT(OrderID where CompanyName = 'United Package' and ShippedDate > = '1996-01-01 00:00:00' AND ShippedDate < '1997-01-01 00:00:00')) 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...
How many owners are located in Mexico?
SELECT COUNT(ContactTitle) FROM Customers WHERE Country = 'Mexico' AND ContactTitle = 'Owner'
owners in Mexico refer to ContactTitle where Country = 'Mexico';
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 Andr Fonseca?
SELECT Address, City, Region, PostalCode, Country FROM Customers WHERE ContactName = 'Andr Fonseca'
full address includes Address, City, Region, PostalCode and Country; ContactName = 'Andr Fonseca';
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 companies that have the same phone area code as 171?
SELECT CompanyName FROM Customers WHERE Phone LIKE '(171)%'
phone area code as 171 refers to Phone LIKE '(171)%'; companies refer 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...
What is the difference in the number of employees from the UK and the USA who work as sales representatives?
SELECT ( SELECT COUNT(Title) FROM Employees WHERE Country = 'UK' AND Title = 'Sales Representative' ) - ( SELECT COUNT(Title) FROM Employees WHERE Country = 'USA' AND Title = 'Sales Representative' ) AS DIFFERENCE
SUBTRACT(COUNT(EmployeeID where Country = 'UK' and Title = 'sales representative'), COUNT(EmployeeID where Country = 'USA' and Title = 'sales representative'));
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 associates are located in Sao Paulo, Brazil?
SELECT COUNT(CustomerID) FROM Customers WHERE City = 'Sao Paulo' AND Country = 'Brazil' AND ContactTitle = 'Sales Associate'
sales associates refer to ContactTitle; Sao Paulo is the name of the city in the country Brazil;
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 family name of the employee who shipped the order 10521 to CACTU?
SELECT T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10521 AND T2.CustomerID = 'CACTU'
order 10521 refers to OrderID = 10521; CustomerID = 'CACTU'; family name refers to 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...
What is the shipping cost for order number 10692 from the company Alfreds Futterkiste?
SELECT T2.Freight FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.OrderID = 10692 AND T1.CompanyName = 'Alfreds Futterkiste'
Alfreds Futterkiste is the name of the company; order number 10692 refers to OrderID = 10692;
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 shipping company for order number 10558?
SELECT T2.CompanyName FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T1.OrderID = 10558
order number 10558 refers to OrderID = 10558;
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 list any three order numbers that have been shipped using Speedy Express.
SELECT T1.OrderID FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Speedy Express' LIMIT 3
Speedy Express is the name of the shipping company; three order numbers refer to OrderID LIMIT 3;
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 products that belong to the beverage category?
SELECT T2.ProductName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.CategoryName = 'Beverages'
products belong to beverage category refer to ProductName where CategoryName = 'beverage';
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 description of the category that tofu belongs to?
SELECT T1.Description FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.ProductName = 'tofu'
tofu is the name of the product;
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 company supplies Gula Malacca?
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Gula Malacca'
Gula Malacca is the name of the product; 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...
What are the products that are supplied by Aux joyeux ecclsiastiques?
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Aux joyeux ecclsiastiques'
Aux joyeux ecclsiastiques is the name of supply company; products refer to 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...
How much per unit of Konbu does Mayumi's charge?
SELECT T1.UnitPrice FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName LIKE 'Mayumi%' AND T1.ProductName = 'Konbu'
Mayumi's is the name of the company; how much per unit of Konbu refers to UnitPrice where ProductName = 'Konbu';
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 is the person to contact to get Camembert Pierrot?
SELECT T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Camembert Pierrot'
Camembert Pierrot is the name of the product; person to contact 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...
Please name any three products that have been discontinued in the meat or poultry category.
SELECT T2.ProductName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.Discontinued = 1 AND T1.CategoryName = 'Meat/Poultry' LIMIT 3
three products that have been discontinued refer to ProductName LIMIT 3 where Discontinued = 1; CategoryName = 'Meat/Poultry';
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 name any two products that have the highest satisfaction levels among users of Heli Swaren GmbH & Co. KG.
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Heli Swaren GmbH & Co. KG' ORDER BY T1.ReorderLevel DESC LIMIT 2
High reorder level generally means high user satisfaction; the highest satisfaction levels refer to MAX(ReorderLevel); two products refer to ProductName LIMIT 2; CompanyName = 'Heli Swaren GmbH & Co. KG';
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 is the one representing the company "Heli Swaren GmbH & Co. KG"?
SELECT ContactName FROM Suppliers WHERE CompanyName = 'Heli Swaren GmbH & Co. KG'
Heli Swaren GmbH & Co. KG is the name of the company; who is representing 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...
From which country is the company "Drachenblut Delikatessen" from?
SELECT Country FROM Customers WHERE CompanyName = 'Drachenblut Delikatessen'
Drachenblut Delikatessen is the company name;
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 territories are there?
SELECT COUNT(TerritoryID) FROM Territories
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 largest total price for an order?
SELECT SUM(UnitPrice) FROM `Order Details` GROUP BY OrderID ORDER BY SUM(UnitPrice) DESC LIMIT 1
the largest total price for an order can be calculated as MAX(MULTIPLY(UnitPrice, Quantity, SUBTRACT(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...
Which product is the most expensive?
SELECT ProductName FROM Products WHERE UnitPrice = ( SELECT MAX(UnitPrice) FROM Products )
most expensive product refers to ProductName where 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...
How many of the orders are shipped to France?
SELECT COUNT(ShipCountry) FROM Orders WHERE ShipCountry = 'France'
shipped to France refers to ShipCountry = 'France';
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 region does Hoffman Estates belong to?
SELECT T2.RegionDescription FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T1.TerritoryDescription = 'Hoffman Estates'
Hoffman Estates refer to 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...
What is the homepage link for the company that supplies the product "Thringer Rostbratwurst"?
SELECT T2.HomePage FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Thringer Rostbratwurst'
ProductName = 'Thringer Rostbratwurst';
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 first names of the employees who take the orders that ship to the city of "Reims".
SELECT DISTINCT T1.FirstName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.ShipCity = 'Reims'
ship to the city of "Reims" refers to ShipCity = Reims';
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 largest quantity of "Manjimup Dried Apples" for an order?
SELECT T2.Quantity FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T2.ProductID = T1.ProductID WHERE T1.ProductName = 'Manjimup Dried Apples' ORDER BY T2.Quantity DESC LIMIT 1
the largest quantity of "Manjimup Dried Apples" refers to MAX(Quantity) where ProductName = 'Manjimup Dried Apples';
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 "Speedy Express"?
SELECT 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 the name of the shipping company; orders refer 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...
Make a list of all the territories in the Southern region.
SELECT DISTINCT T1.TerritoryDescription FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Southern'
territories in the Southern region refer to TerritoryDescription WHERE RegionDescription = 'Southern';
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 prices on cheese products?
SELECT T2.UnitPrice FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.Description = 'Cheeses'
prices on cheese refer to UnitPrice WHERE Description = 'Cheeses';
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 did "Laughing Bacchus Wine Cellars" make?
SELECT COUNT(T2.OrderID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.CompanyName = 'Laughing Bacchus Wine Cellars'
"Laughing Bacchus Wine Cellars" is the name of the company; orders refer 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...
List all the products that were shipped to Starenweg 5.
SELECT T3.ProductName 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 T1.ShipAddress = 'Starenweg 5' GROUP BY T3.ProductName
products shipped to Starenweg 5 refer to ProductName where ShipAddress = 'Starenweg 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...
What are the products by the company "Bigfoot Breweries"?
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Bigfoot Breweries'
Bigfoot Breweries is the name of the company; products refer to 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 are the names of Robert King's territories?
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.LastName = 'King' AND T1.FirstName = 'Robert'
Robert King is a full name of an employee where LastName = 'King' AND FirstName = 'Robert'; names of territories refer to 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...
Provide the name of the contact person who made the orders that shipped to Switzerland.
SELECT T1.ContactName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.ShipCountry = 'Switzerland' GROUP BY T1.ContactName
shipped to Switzerland refers to ShipCountry = 'Switzerland'; contact person refers to Customers;
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 proportion of orders are taken by the Sales Representative?
SELECT CAST(COUNT(CASE WHEN T1.Title = 'Sales Representative' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.OrderID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID
DIVIDE(COUNT(OrderID where Title = 'Sales Representative'), COUNT(OrderID)) 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...
Among the USA employess, how many of them has PhD title of courtesy?
SELECT COUNT(Country) FROM Employees WHERE TitleOfCourtesy = 'Dr.' AND Country = 'USA'
"USA" is the Country; PhD title of courtesy refers to TitleOfCourtesy = 'Dr.'
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 average salary for employees from ID 1 to 9?
SELECT AVG(Salary) FROM Employees WHERE EmployeeID BETWEEN 1 AND 9
ID 1 to 9 refers to EmployeeID BETWEEN 1 AND 9; 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 total salary for employees from UK.
SELECT SUM(Salary) FROM Employees WHERE Country = 'UK'
"UK" is the Country; total salary refers to Sum(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...
Is (206) 555-1189 the home phone number for Laura Callahan?
SELECT CASE WHEN HomePhone = '(206) 555-1189' THEN 'YES' ELSE 'NO' END FROM Employees WHERE FirstName = 'Laura' AND LastName = 'Callahan'
"Laura Callahan" refers to 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...
Write down the notes of employee with the highest salary.
SELECT Notes FROM Employees WHERE Salary = ( SELECT MAX(Salary) FROM Employees )
highest salary refers to Max(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...
List down the customer ids who placed order with Michael Suyama.
SELECT T2.CustomerID FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Michael' AND T1.LastName = 'Suyama'
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...
Where are the ship countries of orders placed by Janet Leverling?
SELECT DISTINCT T2.ShipCountry FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Janet' AND T1.LastName = 'Leverling'
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 Margaret Peacock placed?
SELECT COUNT(T2.EmployeeID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Margaret' AND T1.LastName = 'Peacock'
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 average salary per order for Andrew Fuller.
SELECT CAST(SUM(T1.Salary) AS REAL) / COUNT(T2.EmployeeID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Andrew' AND T1.LastName = 'Fuller'
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...
What are the product names of Exotic Liquids?
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Exotic Liquids'
"Exotic Liquids" is the 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...
List down the quantity per unit for products of Tokyo Traders.
SELECT T1.QuantityPerUnit FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Tokyo Traders'
"Tokyo Traders" is the 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 products have been discountinued by New Orleans Cajun Delights?
SELECT COUNT(T1.Discontinued) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'New Orleans Cajun Delights'
"New Orleans Cajun Delights" is the CompanyName; discontinued 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...
Please calculate the average unit price for products of Formaggi Fortini s.r.l.
SELECT SUM(T1.UnitPrice) / COUNT(T1.SupplierID) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Formaggi Fortini s.r.l.'
"Formaggi Fortini s.r.l." is the CompanyName; average unit price = AVG(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...
Calculate the total products that are supplied by Japan suppliers.
SELECT COUNT(T1.SupplierID) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'Japan'
Japan Supplier refers to Country = 'Japan'; total product refers to Count (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 is the contact name for product Teatime Chocolate Biscuits?
SELECT T2.ContactName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Teatime Chocolate Biscuits'
"Teatime Chocolate Biscuits" is the 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...
List down the company names that have the highest reorder level.
SELECT DISTINCT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ReorderLevel = ( SELECT MAX(ReorderLevel) FROM Products )
Highest 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...
What is the contact title for the person who supplied a product that is 10 boxes x 12 pieces.
SELECT T2.ContactTitle FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.QuantityPerUnit = '10 boxes x 12 pieces'
"10 boxes x 12 pieces" is the QuantityPerUnit
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 total units on order from Exotic Liquids?
SELECT SUM(T1.UnitsOnOrder) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Exotic Liquids'
"Exotic Liquids" is the CompanyName; total unit on order = Sum(UnitsOnOrder)
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 of products supplied by Gai pturage over all products.
SELECT CAST(COUNT(CASE WHEN T2.CompanyName = 'Gai pturage' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.SupplierID) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID
"Gai pturage" is the CompanyName; Percentage = Divide (Count(SupplierID where CompanyName = 'Gai pturage'), Count (SupplierID)) * 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...
List the product ID of the top five products, by descending order, the number of quantities in stock.
SELECT ProductID FROM Products ORDER BY UnitsInStock DESC LIMIT 5
by descending in number of quantity in stock refers to max(UnitsInStock)
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 products, how many of them were discontinued in production?
SELECT COUNT(*) FROM Products WHERE Discontinued = 1
discontinued 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...
Give me the address, home phone and salary of the Sales Manager.
SELECT Address, HomePhone, Salary FROM Employees WHERE Title = 'Sales Manager'
"Sales Manage" is the 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...
What is the full name of the Vice President of Sales. Give me the URL of his/her photo.
SELECT FirstName, LastName FROM Employees WHERE Title = 'Vice President, Sales'
"Vice Present of Sales" refers to Title = 'Vice President, Sales'; full name refers to FirstName, LastName; url of photo refers to PhotoPath
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 down the top ten companies with the most total sales by amount.
SELECT CompanyName FROM `Sales Totals by Amount` ORDER BY SaleAmount DESC LIMIT 10
most total sales refers to Max(SaleAmount); companies 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...
What is the average sales for each categories?
SELECT AVG(ProductSales) FROM `Sales by Category` GROUP BY CategoryName
average sales = AVG(ProductSales)
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...
Compute the total order quantity for Uncle Bob's Organic Dried Pears so far.
SELECT SUM(T2.Quantity) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductName LIKE 'Uncle Bob%s Organic Dried Pears'
"Uncle Bob's Organic Dried Pears" is the ProductName; total order quantity refers to Sum(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...
Among the seafoods, how many of them have an order quantity of more than 50?
SELECT COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Categories AS T3 ON T1.CategoryID = T3.CategoryID WHERE T3.CategoryName = 'Seafood' AND T2.Quantity > 50
"Seafood" is the CategoryName; order quantity of more than 50 refers to Quantity > 50
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 products whose supplier is Pavlova, Ltd. Please include the product ID and re-order level.
SELECT T1.ProductName, T1.ProductID, T1.ReorderLevel FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Pavlova, Ltd.'
"Pavlova, Ltd" is the CompanyName; products refers to 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...
Who are the suppliers of the discontinued products?
SELECT DISTINCT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.Discontinued = 1
discontinued product refers to Discontinued = 1; supplier 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...
Among the employees, give me the full names of those who have less than 4 territories.
SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.EmployeeID < 4
less than 4 territories refers to EmployeeID where Count(TerritoryID) < 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 employees have territories in the Eastern region?
SELECT COUNT(DISTINCT T1.FirstName) 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 T4.RegionDescription = 'Eastern'
"Eastern" is the 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...
From 1/3/97 to 8/10/97, 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.ShippedDate BETWEEN '1997-03-01 00:00:00' AND '1997-10-08 23:59:59'
from 1/3/97 to 8/10/97 refers to 1997-03-01 < ShippedDate < 1997-10-08; 'Federal Shipping' is the 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...
Tally the customer ID of orders that were shipped to Brazil by Margaret Peacock from 3/31/97 to 12/10/97.
SELECT DISTINCT T2.CustomerID FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.LastName = 'Peacock' AND T1.FirstName = 'Margaret' AND T2.ShipCountry = 'Brazil' AND T2.ShippedDate BETWEEN '1997-03-31 00:00:00' AND '1997-12-10 23:59:59'
"Brazil" is the ShipCountry; from 3/31/97 to 12/10/97 refers to 1997-03-31 < ShippedDate < 1997-10-12
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 re-order level of products that have an order quantity of 1?
SELECT T1.ReorderLevel FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity = 1
order quantity of 1 refers to Quantity = 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 is the stock value of every condiments?
SELECT T1.UnitPrice * T1.UnitsInStock FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID
"Condiments" is the CategoryName; Stock value = MULTIPLY( UnitPrice, UnitInStock)
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 territories are owned by Anne Dodsworth?
SELECT COUNT(T2.TerritoryID) FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.FirstName = 'Anne' AND T1.LastName = 'Dodsworth'
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 of the American customers have experienced a delay in the shipment and how long was the longest?
SELECT T1.CompanyName, TIMESTAMPDIFF(DAY, T2.ShippedDate, T2.RequiredDate) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Country = 'USA' AND TIMESTAMPDIFF(DAY, T2.ShippedDate, T2.RequiredDate) < 0
"American" refers to Country = 'USA'; longest delay in shipment refers to Max(Subtract(RequiredDate, ShippedDate)); customer refers to CustomerID
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 contact name and phone number of the customer who has made the most total payment on the order to date?
SELECT T1.ContactName, T1.Phone 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 T2.OrderID, T1.ContactName, T1.Phone ORDER BY SUM(T3.UnitPrice * T3.Quantity * (1 - T3.Discount)) DESC LIMIT 1
most total payment = Max(Multiply(Quantity, UnitPrice, Subtract(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...
Who is the sales representative of the customer who has made the highest payment? Include the full name of employee and his/her supervisor.
SELECT T4.LastName, T4.FirstName, T4.ReportsTo , T1.Quantity * T1.UnitPrice * (1 - T1.Discount) AS payment FROM `Order Details` AS T1 INNER JOIN Orders AS T2 ON T1.OrderID = T2.OrderID INNER JOIN Customers AS T3 ON T2.CustomerID = T3.CustomerID INNER JOIN Employees AS T4 ON T2.EmployeeID = T4.EmployeeID ORDER BY paymen...
highest payment refers to Max(Multiply(Quantity, UnitPrice, Subtract(1, Discount))); full name refers to FirstName, LastName; his/her supervisor refers to 'ReportsTo'
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 there in Berlin, Germany?
SELECT COUNT(City) FROM Customers WHERE Country = 'Germany' AND City = 'Berlin'
"Berlin" is the City; 'Germany' is the Country
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 does the company Exotic Liquids supply?
SELECT COUNT(T1.ProductName) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Exotic Liquids'
"Exotic Liquids" is the CompanyName of supplier
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 company has the lowest unit price? Please give the company name and the product name.
SELECT T2.CompanyName, T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.UnitPrice = ( SELECT MIN(UnitPrice) FROM Products )
lowest unit price refers to Min(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 average unit price of Tokyo Traders' products?
SELECT SUM(T1.UnitPrice) / COUNT(T2.SupplierID) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Tokyo Traders'
"Tokyo Traders" is the CompanyName; average unit price = AVG(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 territories are there in the Eastern region?
SELECT COUNT(T1.RegionID) FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Eastern'
"Eastern" is the RegionDescription