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