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...
Which region has the most territories?
SELECT T2.RegionID FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID GROUP BY T2.RegionID ORDER BY COUNT(T1.TerritoryID) DESC LIMIT 1
region refers to RegionDescription; most territories refers to Max(Count(TerritoryID))
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 territory id 2116 belong to?
SELECT T2.RegionDescription FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T1.TerritoryID = 2116
region refers to RegionDescription
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What percentage of orders were placed by customers in Madrid city in 1996?
SELECT CAST(COUNT(CASE WHEN T1.City = 'Madrid' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.City) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = 1996
"Madrid" is the City; in 1996 refers to YEAR (OrderDate) = 1996; percentage = Divide (Count (CustomerID where City = 'Madrid'), Count (CustomerID)) * 100
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Please list the full names and titles of all employees.
SELECT FirstName, LastName, Title FROM Employees
full name refers to LastName, FirstName
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 has the highest salary? Please give their first name.
SELECT FirstName, LastName 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...
How many sales representatives whose salaries are higher than 2000?
SELECT COUNT(Title) FROM Employees WHERE Salary > 2000 AND Title = 'Sales Representative'
"Sales Representative" is the Title; higher than 2000 refers to Salary > 2000
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
In 1996, how many orders were from customers in the UK?
SELECT COUNT(T1.CustomerID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1996' AND T1.Country = 'UK'
in 1996 refers to YEAR (OrderDate) = 1996; 'UK' 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...
Which company had the most orders in 1998?
SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1998' GROUP BY T1.CompanyName ORDER BY COUNT(T2.OrderID) DESC LIMIT 1
in 1998 refers to YEAR (OrderDate) = 1998; most orders = Max(Count(CustomerID)); 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...
Please calculate the number of orders from customers by country in 1996.
SELECT COUNT(T2.CustomerID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1996' GROUP BY T1.Country
in 1996 refer to YEAR(OrderDate) = 1996; number of order = Count(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...
How many orders were from Hanna Moos company in 1999?
SELECT COUNT(T2.OrderID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y', T2.OrderDate) = '1999' AND T1.CompanyName = 'Hanna Moos'
"Hanna Moos" is the CompanyName; in 1999 refer to YEAR (OrderDate) = 1999
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 days was the fastest shipping of Berglunds snabbkp's order?
SELECT datediff(T2.ShippedDate, T2.OrderDate) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.CompanyName = 'Berglunds snabbkp' ORDER BY datediff(T2.ShippedDate, T2.OrderDate) LIMIT 1
Berglunds snabbkp is the CompanyName; fastest shipping = Min(Subtract(ShippedDate, 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...
Which company placed the order with the id 10257?
SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.OrderID = 10257
"10257" is the OrderID; 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...
In which year did Around the Horn place the most orders?
SELECT STRFTIME('%Y', T2.OrderDate) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.CompanyName = 'Around the Horn' GROUP BY STRFTIME('%Y', T2.OrderDate) ORDER BY COUNT(T2.OrderID) DESC LIMIT 1
Around the Horn is the CompanyName; year with the most order refers to Year (OrderDate) where Max(Count(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...
How many employees report to Andrew Fuller?
SELECT COUNT(EmployeeID) FROM Employees WHERE ReportsTo = ( SELECT EmployeeID FROM Employees WHERE LastName = 'Fuller' AND FirstName = 'Andrew' )
"Andrew Fuller" refers to FirstName = 'Andrew' AND LastName = 'Fuller'; report to refers to ReportsTo ! = NULL
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 country are the majority of the suppliers located?
SELECT Country FROM Suppliers GROUP BY Country ORDER BY COUNT(SupplierID) DESC LIMIT 1
majority of the suppliers located refers to MAX(COUNT(SupplierID))
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the full name of the employees who report to the Sales Manager?
SELECT FirstName, LastName FROM Employees WHERE ReportsTo = ( SELECT EmployeeID FROM Employees WHERE Title = 'Sales Manager' )
full name refers to LastName, FirstName; the Sales Manager refers to Title = 'Sales Manager'; report to refers to ReportsTo is not NULL;
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...
In August of 1996, how many orders were placed by the customer with the highest amount of orders?
SELECT COUNT(OrderID) FROM Orders WHERE OrderDate LIKE '1996-08%' GROUP BY CustomerID ORDER BY COUNT(OrderID) DESC LIMIT 1
August of 1996 refers to OrderDate = '1996-8'; highest amount of orders refers to MAX(COUNT(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...
How much is the salary of the first employee that was hired?
SELECT Salary FROM Employees WHERE HireDate = ( SELECT MIN(HireDate) FROM Employees )
first employee that was hired refers to MIN(HireDate)
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How old was the oldest employee at the time he or she was hired?
SELECT MAX(TIMESTAMPDIFF(YEAR, BirthDate, HireDate)) FROM Employees
oldest employee at the time he or she was hired refers to MAX(SUBTRACT(HireDate, Birthdate))
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the total sales amount of all discontinued products?
SELECT SUM(T2.UnitPrice * T2.Quantity) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Discontinued = 1
discontinued products refers to Discontinued = 1; total sales amount refers to SUM(MULTIPLY(UnitPrice, Quantity))
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the category of the product that has the highest number of discontinued products?
SELECT T2.CategoryName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.Discontinued = 1 GROUP BY T2.CategoryName ORDER BY COUNT(T1.ProductID) DESC LIMIT 1
discontinued products refers to Discontinued = 1; highest number of discontinued products refers to MAX(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...
How many condiments were sold in 1997?
SELECT COUNT(T2.ProductID) FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID INNER JOIN `Order Details` AS T3 ON T2.ProductID = T3.ProductID INNER JOIN Orders AS T4 ON T3.OrderID = T4.OrderID WHERE T1.CategoryName = 'Condiments' AND T1.CategoryID = 2 AND T4.OrderDate LIKE '1997%'
"Condiments" is the CategoryName; in 1997 refers to year(OrderDate) = 1997;
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 customer who purchased the highest number of products in a single order?
SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID GROUP BY T1.CompanyName ORDER BY COUNT(T3.ProductID) DESC LIMIT 1
highest number of products refers to MAX(COUNT(ProductID))
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the monthly average number of products shipped via Federal Shipping for the year 1996?
SELECT CAST(SUM(T1.ShipVia) AS REAL) / 12 FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Federal Shipping' AND T1.ShippedDate LIKE '1996%'
monthly average number of products refers to DIVIDE(SUM(OrderID), 12); shipped via Federal Shipping refers to CompanyName = 'Federal Shipping'; for the year 1996 refers to year(ShippedDate) = 1996
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Which products are being supplied by "G'day, Mate"? List all of their names.
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName LIKE 'G%day, Mate'
supplied by "G'day, Mate" refers to CompanyName = 'G''day, Mate';
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 region with the highest number of territories?
SELECT COUNT(T2.RegionDescription), T1.TerritoryDescription, COUNT(*) AS num FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID GROUP BY T1.TerritoryDescription ORDER BY num DESC LIMIT 1
highest number of territories refers to max(TerritoryID)
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 company name of the supplier who supplies the product with the highest unit price?
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.UnitPrice = ( SELECT MAX(UnitPrice) FROM Products )
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 female employees are in charge of 3 or more territories?
SELECT COUNT(EID) FROM ( SELECT T1.EmployeeID AS EID FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T1.TitleOfCourtesy IN ('Ms.' OR 'Mrs.') GROUP BY T1.EmployeeID HAVING COUNT(T2.TerritoryID) >= 3 ) T1
female employees refers to TitleOfCourtesy = 'Mrs.' or TitleOfCourtesy = 'Ms.'; in charge of 3 or more territories refers to TerritoryID > = 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...
Who are the top 8 suppliers supplying the products with the highest user satisfaction?
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID ORDER BY T1.ReorderLevel DESC LIMIT 8
highest user satisfaction 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 company name of the customer who made the biggest amount of purchase in a single order before discount?
SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID WHERE T3.Discount = 0 GROUP BY T1.CompanyName ORDER BY SUM(T3.UnitPrice * T3.Quantity) DESC LIMIT 1
biggest amount of purchase in a single order refers to MAX(MULTIPLY(UnitPrice, Quantity)); before discount refers to Discount = 0
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What was the total amount of sales handled by Nancy Davolio in December 1996, excluding discounts?
SELECT SUM(T3.UnitPrice * T3.Quantity) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID WHERE T1.FirstName = 'Nancy' AND T1.LastName = 'Davolio' AND T2.OrderDate LIKE '1996-12%' AND T3.Discount = 0
in December 1996 refers to year(OrderDate) = 1996 AND month(OrderDate) = 12; excluding discounts refers to Discount = 0; total amount of sales refers to MULTIPLY((UnitPrice, Quantity))
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the total amount of sales made in the year 1997?
SELECT SUM(T2.UnitPrice * T2.Quantity * (1 - T2.Discount)) FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID WHERE T1.OrderDate LIKE '1997%'
year 1997 refers to year(OrderDate) = 1997; total amount of sales refers to (UnitPrice * Quantity)
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the average annual amount of shipped sales from 1997 to 1998?
SELECT SUM(T2.UnitPrice * T2.Quantity * (1 - T2.Discount)) / 3 FROM Orders AS T1 INNER JOIN `Order Details` AS T2 ON T1.OrderID = T2.OrderID WHERE T1.ShippedDate BETWEEN '1996-01-01 00:00:00' AND '1998-12-31 23:59:59'
from 1997 to 1998 refers to ShippedDate > '1996-1-1' and ShippedDate < '1998-12-31'; average annual amount refers to SUM(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...
How many orders were shipped to Venezuela in 1996?
SELECT COUNT(OrderID) FROM Orders WHERE ShipCountry = 'Venezuela' AND STRFTIME('%Y', ShippedDate) = '1996'
shipped to Venezuela refers to ShipCountry = 'Venezuela'; in 1996 refers to year(ShippedDate) = '1996';
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What are the ID and description of the condiments category?
SELECT CategoryID, Description FROM Categories WHERE CategoryName = 'Condiments'
condiments category refers to CategoryName = 'Condiments'; the ID refers to CategoryID
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
List the order IDs, product IDs and unit price of orders which total payment is greater than 15000.
SELECT ProductID, OrderID, UnitPrice FROM `Order Details` WHERE UnitPrice * Quantity * (1 - Discount) > 15000
total payment is greater than 15000 refers to MULTIPLY((Quantity * UnitPrice * (1 - Discount))) > 15000
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 territory IDs under employee ID of 7.
SELECT TerritoryID FROM EmployeeTerritories WHERE EmployeeID = 7
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 supplier company name in Sydney and its homepage address if available.
SELECT CompanyName, HomePage FROM Suppliers WHERE City = 'Sydney'
in Sydney refers to City = 'Sydney';
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 full name of Vie President of Sales and his age when he was hired.
SELECT FirstName, LastName , TIMESTAMPDIFF(YEAR, BirthDate, HireDate) AS AGE FROM Employees WHERE Title = 'Vice President, Sales'
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...
List the supplier company names located in Germany.
SELECT CompanyName FROM Suppliers WHERE Country = 'Germany'
located in Germany refers to Country = 'Germany';
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
List the employees' full names and ages in 2022 who lived in London.
SELECT TitleOfCourtesy, FirstName, LastName , TIMESTAMPDIFF(YEAR, BirthDate, NOW()) AS ages FROM Employees WHERE City = 'London'
in London refers to City = 'London'; ages in 2022 refers to SUBTRACT(2022, year(BirthDate)); full names refers to FirstName, LastName
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
List down the customer company names, addresses, phones and faxes which are located in London.
SELECT CompanyName, Address, Phone, Fax FROM Customers WHERE City = 'London'
in London refers to City = 'London'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
List the full name of employees and titles who have to report to Sales Manager.
SELECT FirstName, LastName, Title FROM Employees WHERE ReportsTo = ( SELECT EmployeeID FROM Employees WHERE Title = 'Sales Manager' )
Sales Manager refers to Title = 'Sales Manager'; full name refers to FirstName, LastName
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
List all the customer company names and cities located in Canada.
SELECT CompanyName, City FROM Customers WHERE Country = 'Canada'
located in Canada refers to Country = 'Canada'
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...
Find the total production amount and product names which had "10 - 500 g pkgs." as quantity per unit.
SELECT UnitsInStock + UnitsOnOrder, ProductName FROM Products WHERE QuantityPerUnit = '10 - 500 g pkgs.'
total production amount refers to ADD(UnitsInstock, 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...
List all the product names and categories of the highest reorder level.
SELECT T2.ProductName, T1.CategoryName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID ORDER BY T2.ReorderLevel DESC LIMIT 1
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...
Describe the supplier companies, cities and products which total production amount is more than 120.
SELECT T2.CompanyName, T2.City, T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.UnitsInStock + UnitsOnOrder > 120
total production amount is more than 120 refers to ADD(UnitsInstock, UnitsOnOrder) > 120
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 contact person name, title and supplied products by "Escargots Nouveaux" company.
SELECT T2.ContactName, T2.ContactTitle, T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Escargots Nouveaux'
"Escargots Nouveaux" company refers to CompanyName = 'Escargots Nouveaux';
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 territory IDs, description and region description under the in-charge of Mrs. Margaret Peacock.
SELECT T3.TerritoryID, T3.TerritoryDescription, T4.RegionDescription FROM Employees AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN Territories AS T3 ON T2.TerritoryID = T3.TerritoryID INNER JOIN Region AS T4 ON T3.RegionID = T4.RegionID WHERE T1.TitleOfCourtesy = 'Mrs.' AND T1.La...
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 were the products supplied by the company in Spain?
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'Spain'
company in Spain refers to Country = 'Spain'; product supplied 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...
What products were ordered by the customer ID "WILMK" which were required on 3/26/1998?
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.RequiredDate LIKE '1998-03-26%' AND T1.CustomerID = 'WILMK'
required on 3/26/1998 refers to RequiredDate = '1998-03-26 00:00:00'; products ordered 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...
Provide the list of product IDs and names under the meat/poultry category.
SELECT T2.ProductName, T1.CategoryName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.ReorderLevel = ( SELECT MAX(ReorderLevel) FROM Products )
meat/poultry category refers to 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...
How many orders were made by the customers in Ireland.
SELECT COUNT(T2.OrderID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Country = 'Ireland'
in Ireland refers to Country = 'Ireland';
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 products list which were ordered in 1996 by the company in Norway.
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.Country = 'Norway' AND STRFTIME('%Y', T2.OrderDate) = '1996'
ordered in 1996 refers to year(OrderDate) = 1996; in Norway refers to Country = 'Norway'
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 orders shipping to Brazil, mention the supplier company of the order which was done by employee Anne Dodsworth in December, 1996 .
SELECT T5.CompanyName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID INNER JOIN Products AS T4 ON T3.ProductID = T4.ProductID INNER JOIN Suppliers AS T5 ON T4.SupplierID = T5.SupplierID WHERE T1.FirstName = 'Anne' AND T1.LastName...
shipping to Brazil refers to ShipCountry = 'Brazil'; in December, 1996  refers to year(OrderDate) = 1996 and month(OrderDate) = 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...
Mention the oldest empoyee's full name, title, salary and number of orders which were shipped to USA by him.
SELECT T1.FirstName, T1.LastName, T1.Title, T1.Salary , COUNT(T2.OrderID) FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE ShipCountry = 'USA' GROUP BY T1.FirstName, T1.LastName, T1.Title, T1.Salary, T1.BirthDate ORDER BY T1.BirthDate LIMIT 1
full name refers to FirstName, LastName; shipped to USA refers to ShipCountry = 'USA'
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
List down the territory IDs and descriptions existed in Southern region.
SELECT T1.TerritoryID, T1.TerritoryDescription FROM Territories AS T1 INNER JOIN Region AS T2 ON T1.RegionID = T2.RegionID WHERE T2.RegionDescription = 'Southern'
in 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...
Calculate the average payment per product under confections category.
SELECT SUM(T2.UnitPrice * T2.Quantity * (1 - T2.Discount)) / 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 = 'Confections'
under confections category refers to CategoryName = 'Confections';
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...
Find the total payment of the orders by customers from San Francisco.
SELECT SUM(T3.UnitPrice * T3.Quantity * (1 - T3.Discount)) AS TOTALPAYMENT 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 WHERE T1.City = 'San Francisco'
from San Francisco refers to City = 'San Francisco'; total payment refers to sum(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...
Calculate the total production for each product which were supplied from Japan
SELECT SUM(T1.UnitsInStock + T1.UnitsOnOrder) FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.Country = 'Japan'
from Japan refers to Country = 'Japan'; total production refers to ADD(UnitsInstock, 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...
Among the supplied products from Australia, describe the discontinued products and the category.
SELECT T2.ProductName, T3.CategoryName FROM Suppliers AS T1 INNER JOIN Products AS T2 ON T1.SupplierID = T2.SupplierID INNER JOIN Categories AS T3 ON T2.CategoryID = T3.CategoryID WHERE T1.Country = 'Australia' AND T2.Discontinued = 1
from Australia refers to Country = 'Australia'; discontinued products refers to Discontinued = 1;
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Mention the supplier country of Ipoh Coffee and the order ID which had maximum in total payment.
SELECT T3.Country, T1.OrderID FROM `Order Details` AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Suppliers AS T3 ON T2.SupplierID = T3.SupplierID WHERE T2.ProductName = 'Ipoh Coffee' ORDER BY T1.UnitPrice * T1.Quantity * (1 - T1.Discount) DESC LIMIT 1
Ipoh Coffee refers to ProductName = 'Ipoh Coffee'; maximum in total payment refers to 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...
Provide the list of products ordered by ID 10979 and calculate its total payment.
SELECT T1.ProductName , SUM(T2.UnitPrice * T2.Quantity * (1 - T2.Discount)) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderID = 10979 GROUP BY T1.ProductName
ordered by ID 10979 refers to OrderID = '10979'; total payment refers to SUM(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...
Among the products under grains/cereals category, provide the contact person and title of the supplier with one digit ID.
SELECT DISTINCT T1.ContactName, T1.ContactTitle FROM Suppliers AS T1 INNER JOIN Products AS T2 ON T1.SupplierID = T2.SupplierID INNER JOIN Categories AS T3 ON T2.CategoryID = T3.CategoryID WHERE T3.CategoryName = 'Grains/Cereals' AND T1.SupplierID BETWEEN 1 AND 10 LIMIT 1
grains/cereals category refers to CategoryName = 'Grains/Cereals'; supplier with one digit ID refers to SupplierID between 1 and 10;
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 Speedy Express's phone number and number of shipped orders on 30th January, 1998.
SELECT T2.Phone, COUNT(T1.OrderID) FROM Orders AS T1 INNER JOIN Shippers AS T2 ON T1.ShipVia = T2.ShipperID WHERE T2.CompanyName = 'Speedy Express' AND T1.ShippedDate LIKE '1998-01-30%' GROUP BY T2.Phone
Speedy Express's refers to CompanyName = 'Speedy Express'; orders on 30th January, 1998 refers to ShippedDate = '1998-01-30 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...
Describe the ordered products which were the most overdue from required date.
SELECT DISTINCT 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 DATEDIFF(T1.ShippedDate, T1.RequiredDate) < 0
the most overdue from required date refers to MIN(SUBTRACT(ShippedDate, RequiredDate) < 0)
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Under the in-charge of inside sales coordinator, provide the product lists which were shipped to Mexico in 1996.
SELECT T4.ProductName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID INNER JOIN Products AS T4 ON T3.ProductID = T4.ProductID WHERE T1.Title = 'Inside Sales Coordinator' AND T2.ShippedDate LIKE '1996%' AND T2.ShipCountry = 'Mexic...
shipped to Mexico refers to ShipCountry = 'Mexico'; in 1996 refers to year(ShippedDate) = 1996; charge of inside sales coordinator refers to 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...
Identify the name of the most popular dairy product in terms of reorder quantity.
SELECT T2.ProductName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.CategoryName = 'Dairy Products' AND T2.ReorderLevel = ( SELECT MAX(ReorderLevel) FROM Products )
'dairy product' refers to CategoryName; most popular reorder quantity 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...
Calculate the production volume of the dairy product 'Mascarpone Fabioli'.
SELECT SUM(UnitsInStock + UnitsOnOrder) FROM Products WHERE ProductName = 'Mascarpone Fabioli'
'Mascarpone Fabioli' is a ProductName; calculation = SUM(UnitsInStock, 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...
Identify the name and product category for the most expensive and the least expensive products.
SELECT T2.ProductName, T1.CategoryName FROM Categories AS T1 INNER JOIN Products AS T2 ON T1.CategoryID = T2.CategoryID WHERE T2.UnitPrice IN (( SELECT MIN(UnitPrice) FROM Products ), ( SELECT MAX(UnitPrice) FROM Products ))
name of product refers to ProductName; category of product refers to CategoryName; the most expensive products refers to MAX(UnitPrice); the least expensive products 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...
Identify the customer, which placed the largest order in terms of value.
SELECT T1.CompanyName FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID GROUP BY T2.CustomerID ORDER BY SUM(T3.UnitPrice * T3.Quantity * (1 - T3.Discount)) DESC LIMIT 1
value refers to SUM(UnitPrice * Quantity * SUBTRACT(1, Discount)); the largest order in value refers to MAX(value)
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...
Identify the number of employees in Northern sales region.
SELECT COUNT(T2.EmployeeID) FROM Territories AS T1 INNER JOIN EmployeeTerritories AS T2 ON T1.TerritoryID = T2.TerritoryID INNER JOIN Region AS T3 ON T1.RegionID = T3.RegionID WHERE T3.RegionDescription = 'Northern'
Northern sales 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 average value of the sales order?
SELECT SUM(UnitPrice * Quantity * (1 - Discount)) / COUNT(OrderID) FROM `Order Details`
calculation = DIVIDE(SUM(UnitPrice * Quantity * SUBTRACT(1, Discount)), COUNT(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...
Find the percentage of discontinued products in Northwind's portfolio of products.
SELECT CAST(COUNT(CASE WHEN Discontinued = 1 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(ProductID) FROM Products
discontinued products refers to Discontinued = 1; calculation = DIVIDE(SUM(Discontinued = 1), COUNT(ProductID)) * 100
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Provide the full name of the employee who processed the sales order with ID 10274.
SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID WHERE T2.OrderID = 10274
full name refers to FirstName, LastName; sales order with ID 10274 refers to OrderID = 10274
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 number of orders placed by the company 'GROSELLA-Restaurante'.
SELECT COUNT(T2.OrderID) FROM Customers AS T1 INNER JOIN Orders AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.CompanyName = 'GROSELLA-Restaurante'
'GROSELLA-Restaurante' 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...
Name products and their quantity ordered by the company 'GROSELLA-Restaurante' in the sales order that was processed by Nancy Davolio.
SELECT T4.ProductName, T3.Quantity FROM Employees AS T1 INNER JOIN Orders AS T2 ON T1.EmployeeID = T2.EmployeeID INNER JOIN `Order Details` AS T3 ON T2.OrderID = T3.OrderID INNER JOIN Products AS T4 ON T3.ProductID = T4.ProductID INNER JOIN Customers AS T5 ON T2.CustomerID = T5.CustomerID WHERE T1.FirstName = 'Nancy' A...
name products refers to ProductName; 'GROSELLA-Restaurante' refers to CompanyName; 'Nancy Davolio' is the full name of an employee; full name refers to FirstName, LastName;
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Identify the total number of orders placed by the customer 'Laughing Bacchus Wine Cellars' and it's average value.
SELECT COUNT(T2.OrderID) , SUM(T3.UnitPrice * T3.Quantity * (1 - T3.Discount)) / COUNT(T2.OrderID) 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 WHERE T1.CompanyName = 'Laughing Bacchus Wine Cellars'
'Laughing Bacchus Wine Cellars' refers to CompanyName; calculation = DIVIDE(SUM(UnitPrice * Quantity * SUBTRACT(1, Discount)), COUNT(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...
How many boxes of 'Pavlova' did Northwind sell?
SELECT COUNT(T2.Quantity) FROM Products AS T1 INNER JOIN `Order Details` AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductName = 'Pavlova'
'Pavlova' is a ProductName
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the salary range for sales representative in Northwind?
SELECT ( SELECT MIN(Salary) FROM Employees WHERE Title = 'Sales Representative' ) AS MIN , ( SELECT MAX(Salary) FROM Employees WHERE Title = 'Sales Representative' ) AS MAX
salary range is BETWEEN max(Salary) AND min(Salary); sales representative is a title
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many suppliers does Northwind have in USA?
SELECT COUNT(SupplierID) FROM Suppliers WHERE Country = 'USA'
'USA' is a country; 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...
What products are no longer sold by Northwind?
SELECT ProductName FROM Products WHERE Discontinued = 1
no longer sold refers to Discontinued = 1; 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 is the Sales Agent for the company 'Eastern Connection'?
SELECT ContactName FROM Customers WHERE CompanyName = 'Eastern Connection' AND ContactTitle = 'Sales Agent'
'Eastern Connection' is a CompanyName; 'Sales Agent' is a ContactTitle
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 companies do ship Northwind's orders?
SELECT COUNT(ShipperID) FROM Shippers
companies refers to ShipperID
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...
Identify the total number of orders processed by Northwind employee named Andrew Fuller. What percent of those orders was shipped to Austria?
SELECT CAST(COUNT(CASE WHEN T2.ShipCountry = 'Austria' 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 WHERE T1.FirstName = 'Andrew' AND T1.LastName = 'Fuller'
'Andrew Fuller' is the full name of an employee; full name refers to FistName, LastName; Austria refers to ShipCountry; calculation = DIVIDE(SUM(ShipCountry = 'Austria'), COUNT(OrderID)) * 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 category name of soft drinks, coffees, teas, beers, and ales in description list.
SELECT CategoryName FROM Categories WHERE Description = 'Soft drinks, coffees, teas, beers, and ales'
Soft drinks, coffees, teas, beers, and ales' is Description of CategoryName
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
List the phone number of company named Around the Horn.
SELECT Phone FROM Customers WHERE CompanyName = 'Around the Horn'
phone number refers to Phone; 'Around the Horn' is a CompanyName
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Indicate the fax of the company Blondesddsl pre et fils in Strasbourg city.
SELECT Fax FROM Customers WHERE CompanyName = 'Blondesddsl pre et fils' AND City = 'Strasbourg'
'Blondesddsl pre et fils' is a CompanyName
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
How many companies are there in the city of London?
SELECT COUNT(CompanyName) FROM Customers WHERE City = 'London'
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...
Indicate the address of the company Eastern Connection whose contact name is Ann Devon.
SELECT Address FROM Customers WHERE CompanyName = 'Eastern Connection' AND ContactName = 'Ann Devon'
'Eastern Connection' is a CompanyName; 'Ann Devon' is the full name of an employee; full name refers to FirstName, LastName
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Indicate which company is located in France?
SELECT CompanyName FROM Customers WHERE Country = 'France'
company refers to CompanyName; France is a 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 product names does the supplier Exotic Liquids have?
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 a CompanyName
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
What is the name of the company that has the product with the highest unit price?
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.UnitPrice = ( SELECT MAX(UnitPrice) FROM Products )
name of the company refers to CompanyName; 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...
Which company name in London city has the most stocked products?
SELECT T2.CompanyName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.City = 'London' ORDER BY T1.UnitsInStock DESC LIMIT 1
the most stocked products 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...
Which product of Exotic Liquids company that have the highest reorder levels?
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'Exotic Liquids' ORDER BY T1.ReorderLevel DESC LIMIT 1
'Exotic Liquids' is a CompanyName; the highest reorder levels 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...
Provide the category name of the Chef Anton's Gumbo Mix product that New Orleans Cajun Delights company has.
SELECT T3.CategoryName FROM Suppliers AS T1 INNER JOIN Products AS T2 ON T1.SupplierID = T2.SupplierID INNER JOIN Categories AS T3 ON T2.CategoryID = T3.CategoryID WHERE T1.CompanyName = 'New Orleans Cajun Delights' AND T2.ProductName LIKE 'Chef Anton%s Gumbo Mix'
'Chef Anton's Gumbo Mix' is a ProductName; 'New Orleans Cajun Delights' is a CompanyName;
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Indicate the name of the country where Leka Trading supplies Ipoh Coffee product.
SELECT T2.Country FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T1.ProductName = 'Ipoh Coffee' AND T2.CompanyName = 'Leka Trading'
'Leka Trading' is a CompanyName; 'Ipoh Coffee' is a ProductName
retail_world
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE Categories ( CategoryID INTEGER PRIMARY KEY AUTOINCREMENT, CategoryName TEXT, Description TEXT ); CREATE TABLE Customers ( CustomerID INTEGER PRIMARY KEY AUTOINCREMENT, CustomerName TEXT, ContactName TEXT, Address TEXT, City TEXT, ...
【DB_ID】 retail_world 【Schema】 # Table: main.Categories [ (CategoryID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CategoryName:TEXT, Examples: [Beverages, Condiments, Confections]), (Description:TEXT) ] # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (CustomerName:TEXT, Examples: [Alfr...
Indicate the category name of the product name with the highest units on order.
SELECT T2.CategoryName FROM Products AS T1 INNER JOIN Categories AS T2 ON T1.CategoryID = T2.CategoryID WHERE T1.UnitsOnOrder = ( SELECT MAX(T1.UnitsOnOrder) FROM 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 is the difference in number of unit price from Chef Anton's Cajun Seasoning product and Chef Anton's Gumbo Mix product of New Orleans Cajun Delights company.
SELECT ( SELECT T1.UnitPrice FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName = 'New Orleans Cajun Delights' AND T1.ProductName LIKE 'Chef Anton%s Cajun Seasoning' ) - ( SELECT T1.UnitPrice FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierI...
Chef Anton's Cajun Seasoning' AND 'Chef Anton''s Gumbo Mix' are ProductName; 'New Orleans Cajun Delights' is a CompanyName; calculation = SUBTRACT(UnitPrice where ProductName = 'Chef Anton's Cajun Seasoning', UnitPrice where ProductName = 'Chef Anton''s Gumbo Mix')
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 Cooperativa de Quesos 'Las Cabras' products have a unit price greater than 20?
SELECT T1.ProductName FROM Products AS T1 INNER JOIN Suppliers AS T2 ON T1.SupplierID = T2.SupplierID WHERE T2.CompanyName LIKE 'Cooperativa de Quesos%' AND T1.UnitPrice > 20
Cooperativa de Quesos 'Las Cabras'' is a CompanyName; unit price greater than 20 refers to UnitPrice > 20