id
int64
0
9.43k
db_id
stringclasses
69 values
schema
stringclasses
69 values
question
stringlengths
24
325
output
stringlengths
23
804
evidence
stringlengths
0
673
filtered_schema
listlengths
0
16
7,000
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
For all the products, list the product name and its corresponding start date for the current standard cost.
SELECT T1.Name, T2.StartDate FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T2.EndDate IS NULL
The current standard cost refers to EndDate is NULL
[ "Product.Name", "Product.ProductID", "ProductCostHistory.EndDate", "ProductCostHistory.ProductID", "ProductCostHistory.StartDate" ]
7,001
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
List the products whereby the standard cost is $80 more than previous standard cost in history.
SELECT T1.Name FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.StandardCost - T2.StandardCost > 80 GROUP BY T1.Name
SUBTRACT(product.StandardCost, CostHistory.StandardCost)>80
[ "Product.Name", "Product.ProductID", "Product.StandardCost", "ProductCostHistory.ProductID", "ProductCostHistory.StandardCost" ]
7,002
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Name all products and total quantity for each item for shopping cart ID 14951.
SELECT T1.Name, T2.Quantity FROM Product AS T1 INNER JOIN ShoppingCartItem AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ShoppingCartID = 14951
[ "Product.Name", "Product.ProductID", "ShoppingCartItem.ProductID", "ShoppingCartItem.Quantity", "ShoppingCartItem.ShoppingCartID" ]
7,003
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
List the product name with more than 5 quantity in the shopping cart.
SELECT T1.Name FROM Product AS T1 INNER JOIN ShoppingCartItem AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 5
Product with more than 5 quantity refers to Quantity>5
[ "Product.Name", "Product.ProductID", "ShoppingCartItem.ProductID", "ShoppingCartItem.Quantity" ]
7,004
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
For all the purchase order transactions, name all the products with low quality.
SELECT DISTINCT T1.Name FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Class = 'L' AND T2.TransactionType = 'P' ORDER BY T1.Name
Low quality refers to the product's quality class, therefore Class = 'L'
[ "Product.Class", "Product.Name", "Product.ProductID", "TransactionHistory.ProductID", "TransactionHistory.TransactionType" ]
7,005
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Provide all the transactions whereby the quantiy is more than 10,000 pieces. State the product name and the selling price.
SELECT DISTINCT T1.Name, T1.ListPrice FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 10000
Quantity more than 10,000 pieces refers to Quantity>10000; selling price refers to ListPrice
[ "Product.ListPrice", "Product.Name", "Product.ProductID", "TransactionHistory.ProductID", "TransactionHistory.Quantity" ]
7,006
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Which is a high quality product but with the lowest transacted quantity?
SELECT T1.Name FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Class = 'H' ORDER BY T2.Quantity ASC LIMIT 1
High quality refers to the product's quality class, therefore Class = 'H'; the lowest transacted quantity refers to Quantity = 1
[ "Product.Class", "Product.Name", "Product.ProductID", "TransactionHistory.ProductID", "TransactionHistory.Quantity" ]
7,007
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
How many transactions are there for product under the Mountain line?
SELECT COUNT(T2.TransactionID) FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductLine = 'M'
The Mountain line refers to the product line, therefore ProductLine = 'M'
[ "Product.ProductID", "Product.ProductLine", "TransactionHistory.ProductID", "TransactionHistory.TransactionID" ]
7,008
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
How much would be the total sales profit for shopping cart ID 20621 ?
SELECT SUM((T1.ListPrice - T1.StandardCost) * T2.Quantity) FROM Product AS T1 INNER JOIN ShoppingCartItem AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ShoppingCartID = 20621
Sales profit = MULTIPLY(SUBTRACT(ListPrice, StandardCost; Quantity)), where ShoppingCartID = '20621'
[ "Product.ListPrice", "Product.ProductID", "Product.StandardCost", "ShoppingCartItem.ProductID", "ShoppingCartItem.Quantity", "ShoppingCartItem.ShoppingCartID" ]
7,009
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
List all product names that are high in quality. Please also state its selling price.
SELECT Name, ListPrice FROM Product WHERE Class = 'H'
High quality refers to the product's quality class, therefore Class = 'H'
[ "Product.Class", "Product.ListPrice", "Product.Name" ]
7,010
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Which product line has the most products that are salable?
SELECT ProductLine FROM Product WHERE FinishedGoodsFlag = 1 GROUP BY ProductLine ORDER BY COUNT(FinishedGoodsFlag) DESC LIMIT 1
Saleable product refers to FinishedGoodsFlag = 1
[ "Product.FinishedGoodsFlag", "Product.ProductLine" ]
7,011
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Provide details of review from reviewer whose name begin with letter 'J'. State the product ID, rating and comments.
SELECT ProductID, Rating, Comments FROM ProductReview WHERE ReviewerName LIKE 'J%'
reviewer whose name begin with letter 'J' = ReviewerName LIKE 'J%'
[ "ProductReview.Comments", "ProductReview.ProductID", "ProductReview.Rating", "ProductReview.ReviewerName" ]
7,012
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
State the product name, product line, rating and the selling price of product with the lowest rating.
SELECT T1.Name, T1.ProductLine, T2.Rating, T1.ListPrice FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID ORDER BY T2.Rating ASC LIMIT 1
Product with the lowest rating refers to the rating given by the reviewer where Rating = 1
[ "Product.ListPrice", "Product.Name", "Product.ProductID", "Product.ProductLine", "ProductReview.ProductID", "ProductReview.Rating" ]
7,013
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Calculate the profit of each products. List all products with more than $100 in profit.
SELECT DISTINCT Name FROM Product WHERE ListPrice - StandardCost > 100
Profit = AVG(SUBTRACT(ListPrice, StandardCost)>100
[ "Product.ListPrice", "Product.Name", "Product.StandardCost" ]
7,014
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
List down the product name, reviewer name, rating and comments for product under the road line.
SELECT T1.Name, T2.ReviewerName, T2.Rating, T2.Comments FROM Product AS T1 INNER JOIN ProductReview AS T2 USING (productID) WHERE T1.ProductLine = 'R'
The Road line refers to the product line, therefore ProductLine = 'R'
[ "Product.Name", "Product.ProductLine", "ProductReview.Comments", "ProductReview.Rating", "ProductReview.ReviewerName" ]
7,015
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
How many people reviewed for product named HL Mountain Pedal? What is the average rating?
SELECT COUNT(T1.ProductID), AVG(T2.Rating) FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'HL Mountain Pedal'
AVG(Rating) = DIVIDE(SUM(rating), COUNT(ReviewerName))
[ "Product.Name", "Product.ProductID", "ProductReview.ProductID", "ProductReview.Rating" ]
7,016
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
List the purchase order whereby all received quantity were rejected? Name those product.
SELECT T1.Name FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.RejectedQty = T2.ReceivedQty AND T2.RejectedQty <> 0
Rejected refers rejected product in which to RejectedQty = 1
[ "Product.Name", "Product.ProductID", "PurchaseOrderDetail.ProductID", "PurchaseOrderDetail.ReceivedQty", "PurchaseOrderDetail.RejectedQty" ]
7,017
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Among all products without any rejected quantity, which product has the highest line total? State the product name and unit price.
SELECT T1.Name, T2.UnitPrice FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.RejectedQty = 0 ORDER BY T2.LineTotal DESC LIMIT 1
Product without any rejected quantity refers to RejectedQty = 0
[ "Product.Name", "Product.ProductID", "PurchaseOrderDetail.LineTotal", "PurchaseOrderDetail.ProductID", "PurchaseOrderDetail.RejectedQty", "PurchaseOrderDetail.UnitPrice" ]
7,018
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
List all product names and its product line for all purchase order with order quantity of 5000 or more.
SELECT T1.Name, T1.ProductLine FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderQty > 4999
Purchase order with order quantity of 5000 or more refers to OrderQty> = 5000
[ "Product.Name", "Product.ProductID", "Product.ProductLine", "PurchaseOrderDetail.OrderQty", "PurchaseOrderDetail.ProductID" ]
7,019
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the total ordered quantity for products under the 'Touring' line?
SELECT SUM(T2.OrderQty) FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductLine = 'T'
The Touring line refers to the product line, therefore ProductLine = 'T'
[ "Product.ProductID", "Product.ProductLine", "PurchaseOrderDetail.OrderQty", "PurchaseOrderDetail.ProductID" ]
7,020
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Among the low quality product, which product has the highest line total? List the product name and its line total?
SELECT T1.Name, T2.LineTotal FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE Class = 'L' ORDER BY OrderQty * UnitPrice DESC LIMIT 1
Low quality refers to the product's quality class, therefore Class = 'L'
[ "Product.Name", "Product.ProductID", "PurchaseOrderDetail.LineTotal", "PurchaseOrderDetail.ProductID" ]
7,021
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Which product has the highest profit on net? State the product name.
SELECT T1.Name FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID ORDER BY T2.LastReceiptCost - T2.StandardPrice DESC LIMIT 1
Profit on net = SUBTRACT(LastReceiptCost, StandardPrice)
[ "Product.Name", "Product.ProductID", "ProductVendor.LastReceiptCost", "ProductVendor.ProductID", "ProductVendor.StandardPrice" ]
7,022
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
List all products with minimum order quantity of 100 and order them by product name in descending order.
SELECT DISTINCT T1.Name FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MinOrderQty = 100 ORDER BY T1.Name DESC
miinimum order quantity refers to MinOrderQty = 100
[ "Product.Name", "Product.ProductID", "ProductVendor.MinOrderQty", "ProductVendor.ProductID" ]
7,023
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
List the name and calculate its profit for product with the highest rating in review.
SELECT T1.Name, T1.ListPrice - T1.StandardCost FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID ORDER BY T2.Rating DESC LIMIT 1
Profit = SUBTRACT(ListPrice, StandardCost); the highest rating in review refers to Rating = 5
[ "Product.ListPrice", "Product.Name", "Product.ProductID", "Product.StandardCost", "ProductReview.ProductID", "ProductReview.Rating" ]
7,024
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the total profit all transactions with product ID 827?
SELECT SUM((T1.ListPrice - T1.StandardCost) * T2.Quantity) FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 827
Profit = MULTIPLY(SUBTRACT(ListPrice, StandardCost) Quantity))
[ "Product.ListPrice", "Product.ProductID", "Product.StandardCost", "TransactionHistory.ProductID", "TransactionHistory.Quantity" ]
7,025
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Which currency pair's average exchange rate for the day is the highest?
SELECT FromCurrencyCode, ToCurrencyCode FROM CurrencyRate ORDER BY AverageRate DESC LIMIT 1
currency pair refers to FromCurrencyCode/ToCurrencyCode
[ "CurrencyRate.AverageRate", "CurrencyRate.FromCurrencyCode", "CurrencyRate.ToCurrencyCode" ]
7,026
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
How many products with the highest unit price were ordered?
SELECT OrderQty FROM PurchaseOrderDetail ORDER BY UnitPrice DESC LIMIT 1
number of products refers to OrderQty
[ "PurchaseOrderDetail.OrderQty", "PurchaseOrderDetail.UnitPrice" ]
7,027
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Between Northwest and Southeast of the United States, which territory one recorded the highest amount of sales last year?
SELECT Name FROM SalesTerritory WHERE CountryRegionCode = 'US' AND (Name = 'Northwest' OR Name = 'Southeast') ORDER BY SalesLastYear DESC LIMIT 1
United States refers to CountryRegionCode = 'US';
[ "SalesTerritory.CountryRegionCode", "SalesTerritory.Name", "SalesTerritory.SalesLastYear" ]
7,028
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the full name of the Document Control Manager who is in charge of all Level 1 approved documents?
SELECT T1.FirstName, T1.MiddleName, T1.LastName FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Document AS T3 ON T3.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Manager' AND T3.DocumentLevel = 1 AND T3.Status = 2 GROUP BY T1.FirstName, T1.MiddleN...
full Name = FirstName+MiddleName+Last Name; approved document refers to Status = 2;
[ "Document.DocumentLevel", "Document.Owner", "Document.Status", "Employee.BusinessEntityID", "Employee.JobTitle", "Person.BusinessEntityID", "Person.FirstName", "Person.LastName", "Person.MiddleName" ]
7,029
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Which customer has the highest subtotal amount of sales orders whose assigned to the salesperson with the highest bonus?
SELECT T1.CustomerID FROM SalesOrderHeader AS T1 INNER JOIN SalesPerson AS T2 ON T1.SalesPersonID = T2.BusinessEntityID ORDER BY T1.SubTotal DESC LIMIT 1
highest subtotal amount of sales order refers to max(SubTotal);
[ "SalesOrderHeader.CustomerID", "SalesOrderHeader.SalesPersonID", "SalesOrderHeader.SubTotal", "SalesPerson.BusinessEntityID" ]
7,030
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the total price of Sales Order ID 46625 with Volume Discount 11 to 14 and Product ID 716?
SELECT T2.UnitPrice * T2.OrderQty FROM SpecialOffer AS T1 INNER JOIN SalesOrderDetail AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID WHERE T1.Description = 'Volume Discount 11 to 14' AND T1.SpecialOfferID = 2 AND T2.ProductID = 716 AND T2.SalesOrderID = 46625
total price = multiply(UnitPrice, OrderQty);
[ "SalesOrderDetail.OrderQty", "SalesOrderDetail.ProductID", "SalesOrderDetail.SalesOrderID", "SalesOrderDetail.SpecialOfferID", "SalesOrderDetail.UnitPrice", "SpecialOffer.Description", "SpecialOffer.SpecialOfferID" ]
7,031
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Of the products that has a reorder inventory point of no more than 600, how many manufactured in-house products that takes 1 day to manufacture with BOM Level 4 are there?
SELECT COUNT(T1.ProductID) FROM Product AS T1 INNER JOIN BillOfMaterials AS T2 ON T1.ProductID = T2.ProductAssemblyID WHERE T1.MakeFlag = 1 AND T1.DaysToManufacture = 1 AND T2.BOMLevel = 4 AND T1.ReorderPoint <= 600
ReorderPoint<600; product is manufactured in-house refers to Makeflag = 1;
[ "BillOfMaterials.BOMLevel", "BillOfMaterials.ProductAssemblyID", "Product.DaysToManufacture", "Product.MakeFlag", "Product.ProductID", "Product.ReorderPoint" ]
7,032
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the highest amount of bonus earned by the sales person in Canada?
SELECT T2.Bonus FROM SalesTerritory AS T1 INNER JOIN SalesPerson AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.CountryRegionCode = 'CA' ORDER BY T2.SalesQuota DESC LIMIT 1
Canada is name of a sales territory
[ "SalesPerson.Bonus", "SalesPerson.SalesQuota", "SalesPerson.TerritoryID", "SalesTerritory.CountryRegionCode", "SalesTerritory.TerritoryID" ]
7,033
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What are the names of the product that has the lowest rating?
SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Rating = ( SELECT Rating FROM ProductReview ORDER BY Rating ASC LIMIT 1 )
lowest rating refers to Rating = 1;
[ "Product.Name", "Product.ProductID", "ProductReview.ProductID", "ProductReview.Rating" ]
7,034
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
How many of the workers who started working in 2009 are from the Production Department?
SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID WHERE T2.StartDate >= '2009-01-01' AND T2.StartDate < '2010-01-01' AND T1.Name = 'Production'
StartDate BETWEEN '2009-01-01' AND '2009-12-31';
[ "Department.DepartmentID", "Department.Name", "EmployeeDepartmentHistory.BusinessEntityID", "EmployeeDepartmentHistory.DepartmentID", "EmployeeDepartmentHistory.StartDate" ]
7,035
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Who is the company's highest-paid single female employee? Include her full name and job title.
SELECT T3.FirstName, T3.MiddleName, T3.LastName, T1.JobTitle FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Person AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.MaritalStatus = 'S' AND T1.Gender = 'F' ORDER BY T2.Rate DESC LIMIT 1
full name = FirstName+MiddleName+LastName; highest-paid refers to max(Rate); single refers to Status = 'S'; female refers to Gender = 'F';
[ "Employee.BusinessEntityID", "Employee.Gender", "Employee.JobTitle", "Employee.MaritalStatus", "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.Rate", "Person.BusinessEntityID", "Person.FirstName", "Person.LastName", "Person.MiddleName" ]
7,036
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Who is the Vice President of Engineering and when did he join the company? Indicate his/her full name.
SELECT T2.FirstName, T2.MiddleName, T2.LastName, T1.HireDate FROM Employee AS T1 INNER JOIN Person AS T2 USING (BusinessEntityID) WHERE T1.JobTitle = 'Vice President of Engineering'
full name = FirstName+MiddleName+LastName; HiredDate refers to the date the person joins the company;
[ "Employee.HireDate", "Employee.JobTitle", "Person.FirstName", "Person.LastName", "Person.MiddleName" ]
7,037
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
How many active employees whose payrate is equal or below 30 per hour.
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.CurrentFlag = 1 AND T2.Rate <= 30
active employee refers to CurrentFlag = 1; Rate< = 30;
[ "Employee.BusinessEntityID", "Employee.CurrentFlag", "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.Rate" ]
7,038
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Which department has a worker who just recently started working?
SELECT T1.Name FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID ORDER BY T2.StartDate DESC LIMIT 1
recently started working refers to latest StartDate;
[ "Department.DepartmentID", "Department.Name", "EmployeeDepartmentHistory.DepartmentID", "EmployeeDepartmentHistory.StartDate" ]
7,039
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Which store sales person was reently hired? Indicate his/her full name and gender.
SELECT T2.FirstName, T2.MiddleName, T2.LastName, T1.Gender FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP'
SC is an abbreviation for Store Contact; store contact person refers to PersonType = 'SC'; recently hired refers to latest StartDate;
[ "Employee.BusinessEntityID", "Employee.Gender", "Person.BusinessEntityID", "Person.FirstName", "Person.LastName", "Person.MiddleName", "Person.PersonType" ]
7,040
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
How frequently do the employee with the least number of sick leave hours get paid?
SELECT T2.PayFrequency FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.SickLeaveHours ASC LIMIT 1
least number of sick leave refers to min(SickLeaveHours); PayFrequency = 1 means ‘Salary received monthly’; PayFrequency = 2 means ‘Salary received biweekly';
[ "Employee.BusinessEntityID", "Employee.SickLeaveHours", "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.PayFrequency" ]
7,041
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Which job title has the lowest pay?
SELECT T1.JobTitle FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.Rate ASC LIMIT 1
lowest pay refers to min(Rate);
[ "Employee.BusinessEntityID", "Employee.JobTitle", "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.Rate" ]
7,042
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the total number of employees that worked in the Finance department?
SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 USING (DepartmentID) WHERE T1.Name = 'Finance'
[ "Department.Name", "EmployeeDepartmentHistory.BusinessEntityID" ]
7,043
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the profit of the product with the highest list price and of the product with the lowest list price other than 0? Indicates the depth the component is from its parent.
SELECT ( SELECT ListPrice - StandardCost FROM Product WHERE ListPrice != 0 ORDER BY ListPrice DESC LIMIT 1 ) , ( SELECT ListPrice - StandardCost FROM Product WHERE ListPrice != 0 ORDER BY ListPrice LIMIT 1 )
profit = subtract(ListPrice, StandardCost); the depth the component from its parent refers to BOMLevel;
[ "Product.ListPrice", "Product.StandardCost" ]
7,044
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Among the companies to which Adventure Works Cycles purchases parts or other goods, what is the profit on net obtained from the vendor who has an above average credit rating? Kindly indicate each names of the vendor and the corresponding net profits.
SELECT T2.Name, T1.LastReceiptCost - T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CreditRating = 3
above average credit rating refers to CreditRating = 3; profit on net = subtract(LastReceiptCost, StandardPrice);
[ "ProductVendor.BusinessEntityID", "ProductVendor.LastReceiptCost", "ProductVendor.StandardPrice", "Vendor.BusinessEntityID", "Vendor.CreditRating", "Vendor.Name" ]
7,045
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
How many accounts have an address that is too long?
SELECT COUNT(*) FROM Address WHERE AddressLine2 <> ''
address that is too long refers to AddressLine2! = null
[ "Address.AddressLine2" ]
7,046
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the postal code of the street address of the account that is latest updated?
SELECT PostalCode FROM Address ORDER BY ModifiedDate DESC LIMIT 1
account latest updated refers to year(ModifiedDate) = 2022 and month(ModifiedDate) = 10
[ "Address.ModifiedDate", "Address.PostalCode" ]
7,047
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the longest assembly item duration for bicycles?
SELECT JULIANDAY(EndDate) - JULIANDAY(StartDate) FROM BillOfMaterials ORDER BY JULIANDAY(EndDate) - JULIANDAY(StartDate) DESC LIMIT 1
longest assembly item duration = max(subtract(EndDate,StartDate))
[ "BillOfMaterials.EndDate", "BillOfMaterials.StartDate" ]
7,048
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
How many assembly items for bicycles aren't finished?
SELECT COUNT(BillOfMaterialsID) FROM BillOfMaterials WHERE EndDate IS NULL
assembly lines that are not finished refers to EndDate = null
[ "BillOfMaterials.BillOfMaterialsID", "BillOfMaterials.EndDate" ]
7,049
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Please list the unit measure code of the component that is of the greatest need in quantity to create the assembly.
SELECT UnitMeasureCode FROM BillOfMaterials ORDER BY PerAssemblyQty DESC LIMIT 1
greatest need in quantity refers to max(PerAssemblyQty)
[ "BillOfMaterials.PerAssemblyQty", "BillOfMaterials.UnitMeasureCode" ]
7,050
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
How many product maintenance documents are private?
SELECT COUNT(DocumentNode) FROM Document WHERE DocumentSummary IS NULL
product maintenance documents are private refers to DocumentSummary = null
[ "Document.DocumentNode", "Document.DocumentSummary" ]
7,051
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Please list the titles of the documents that are pending approval.
SELECT Title FROM Document WHERE Status = 1
documents pending approval refers to Status = 1
[ "Document.Status", "Document.Title" ]
7,052
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Please list the job titles of the employees who has a document that has been approved.
SELECT DISTINCT T2.BusinessEntityID, T2.JobTitle FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T1.Status = 2
document has been approved refers to Status = 2
[ "Document.Owner", "Document.Status", "Employee.BusinessEntityID", "Employee.JobTitle" ]
7,053
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the pay frequency of the oldest employee?
SELECT T1.PayFrequency FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.BirthDate ASC LIMIT 1
oldest employee refers to min(BirthDate); PayFrequency = 1 refers to ‘Salary received monthly’; PayFrequency = 2 refers to ‘Salary received biweekly'
[ "Employee.BirthDate", "Employee.BusinessEntityID", "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.PayFrequency" ]
7,054
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Among the employees whose pay frequencies are the highest, how many of them are married?
SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.MaritalStatus = 'M' AND T1.PayFrequency = ( SELECT PayFrequency FROM EmployeePayHistory ORDER BY PayFrequency DESC LIMIT 1 )
married refers to MaritalStatus = M; highest pay frequency refers to PayFrequency = 2
[ "Employee.BusinessEntityID", "Employee.MaritalStatus", "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.PayFrequency" ]
7,055
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
For the employee who has been hired the latest, what is his or her pay rate?
SELECT T1.Rate FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.HireDate DESC LIMIT 1
hired the latest refers to max(HireDate)
[ "Employee.BusinessEntityID", "Employee.HireDate", "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.Rate" ]
7,056
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Among the employees who have a pay rate of above 40, how many of them are male?
SELECT SUM(CASE WHEN T2.Gender = 'M' THEN 1 ELSE 0 END) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Rate > 40
pay rate above 40 refers to Rate>40; male employee refers to Gender = M
[ "Employee.BusinessEntityID", "Employee.Gender", "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.Rate" ]
7,057
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the highest pay rate of the employees who are exempt from collective bargaining?
SELECT T1.Rate FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.SalariedFlag = 1 ORDER BY T1.Rate DESC LIMIT 1
employee exempt from collective bargaining refers to SalariedFlag = 1; highest pay rate refers to max(Rate)
[ "Employee.BusinessEntityID", "Employee.SalariedFlag", "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.Rate" ]
7,058
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
For the employees who have the highest pay frequency, please list their vacation hours.
SELECT T2.VacationHours FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.BusinessEntityID = ( SELECT BusinessEntityID FROM EmployeePayHistory ORDER BY Rate DESC LIMIT 1 )
highest pay frequency refers to PayFrequency = 2
[ "Employee.BusinessEntityID", "Employee.VacationHours", "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.Rate" ]
7,059
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the pay rate of the employee who has the longest vacation hours?
SELECT T1.Rate FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.VacationHours DESC LIMIT 1
longest vacation hour refers to max(VacationHours)
[ "Employee.BusinessEntityID", "Employee.VacationHours", "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.Rate" ]
7,060
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
How many employees with a pay rate of over 35 have more than 10 sick leave hours?
SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.SickLeaveHours > 10 AND T1.Rate > 35
more than 10 sick leave hours refers to SickLeaveHours>10; pay rate over 35 refers to Rate>35;
[ "Employee.BusinessEntityID", "Employee.SickLeaveHours", "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.Rate" ]
7,061
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Among the active male employees, how many of them are paid with the highest frequency?
SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.Gender = 'M' AND T1.PayFrequency = 2
active status of employees refers to CurrentFlag = 1; Male refers to Gender = 'M'; highest frequency refers to PayFrequency = 2;
[ "Employee.BusinessEntityID", "Employee.CurrentFlag", "Employee.Gender", "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.PayFrequency" ]
7,062
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
How many male employees have the job position of sales person?
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Gender = 'M' AND T2.PersonType = 'SP'
Sales person refers to PersonType = 'SP'; Male refers to Gender = 'M';
[ "Employee.BusinessEntityID", "Employee.Gender", "Person.BusinessEntityID", "Person.PersonType" ]
7,063
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the job position of the oldest employee?
SELECT T2.PersonType FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.BirthDate ASC LIMIT 1
Oldest employee refers to Max ( Subtract((now())-BirthDate));
[ "Employee.BirthDate", "Employee.BusinessEntityID", "Person.BusinessEntityID", "Person.PersonType" ]
7,064
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the name style of the employee with the lowest pay rate?
SELECT T2.NameStyle FROM EmployeePayHistory AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Rate IS NOT NULL ORDER BY T1.Rate ASC LIMIT 1
lowest pay rate refers to Min(Rate);
[ "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.Rate", "Person.BusinessEntityID", "Person.NameStyle" ]
7,065
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Among the employees who are married, how many of them have a western name style?
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.NameStyle = 0 AND T1.MaritalStatus = 'M'
married refers to MaritalStatus = 'M'; western name style refers to NameStyle = '0';
[ "Employee.BusinessEntityID", "Employee.MaritalStatus", "Person.BusinessEntityID", "Person.NameStyle" ]
7,066
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Among the employees who have more than 10 hours of sick leave, how many of them wish to receive e-mail promotions?
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 1 AND T1.SickLeaveHours > 10
Contact does wish to receive e-mail promotions refers to EmailPromotion = (1,2); more than 10 hours of sick leave refer to SickLeaveHours >10;
[ "Employee.BusinessEntityID", "Employee.SickLeaveHours", "Person.BusinessEntityID", "Person.EmailPromotion" ]
7,067
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Please list the employees who have more than 20 vacations hours and wish to receive e-mail promotions.
SELECT T1.BusinessEntityID FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 1 AND T1.VacationHours > 20
Contact does wish to receive e-mail promotions refers to EmailPromotion = (1,2); more than 20 vacations hours refers to VacationHours>20
[ "Employee.BusinessEntityID", "Employee.VacationHours", "Person.BusinessEntityID", "Person.EmailPromotion" ]
7,068
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Please give the additional contact information of the oldest employee with the jod position of sales person.
SELECT T2.AdditionalContactInfo FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE PersonType = 'SP' ORDER BY T1.BirthDate ASC LIMIT 1
Sales person refers to PersonType = 'SP'; oldest employee refers to Max (Subtract((now())-BirthDate));
[ "Employee.BirthDate", "Employee.BusinessEntityID", "Person.AdditionalContactInfo", "Person.BusinessEntityID" ]
7,069
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the first name of the male employee who has a western name style?
SELECT T2.FirstName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.NameStyle = 0 AND T1.Gender = 'M'
western name style refers to NameStyle = 0; Male refers to Gender = 'M';
[ "Employee.BusinessEntityID", "Employee.Gender", "Person.BusinessEntityID", "Person.FirstName", "Person.NameStyle" ]
7,070
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Among the active employees, how many of them have a courtesy title of "Mr"?
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.CurrentFlag = 1 AND T2.Title = 'Mr.'
active status of employees refers to CurrentFlag = 1;
[ "Employee.BusinessEntityID", "Employee.CurrentFlag", "Person.BusinessEntityID", "Person.Title" ]
7,071
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Please give the personal information of the married employee who has the highest pay rate.
SELECT T2.Demographics FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmployeePayHistory AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.MaritalStatus = 'M' ORDER BY T3.Rate DESC LIMIT 1
married refers to MaritalStatus = 'M'; Highest pay rate refers to Max(Rate)
[ "Employee.BusinessEntityID", "Employee.MaritalStatus", "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.Rate", "Person.BusinessEntityID", "Person.Demographics" ]
7,072
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the surname suffix of the employee who works as a store contact and has the longest sick leave hours?
SELECT T2.Suffix FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP' ORDER BY T1.SickLeaveHours DESC LIMIT 1
store contact refers to PersonType = 'SC';
[ "Employee.BusinessEntityID", "Employee.SickLeaveHours", "Person.BusinessEntityID", "Person.PersonType", "Person.Suffix" ]
7,073
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Among the married employees with the highest pay frequency, how many of them have an eastern name style?
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmployeePayHistory AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.MaritalStatus = 'M' AND T2.NameStyle = 1 AND T3.Rate = ( SELECT Rate FROM EmployeePayHistory ORDER BY Rate ...
married refers to MaritalStatus = 'M'; Eastern name style refers to NameStyle = 1;
[ "Employee.BusinessEntityID", "Employee.MaritalStatus", "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.Rate", "Person.BusinessEntityID", "Person.NameStyle" ]
7,074
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
How many active employees do not wish to receive e-mail promotions?
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.CurrentFlag = 1 AND T2.EmailPromotion = 1
active status of employees refers to CurrentFlag = 1; the employee does not wish to receive an e-mail promotion refers to EmailPromotion = 0;
[ "Employee.BusinessEntityID", "Employee.CurrentFlag", "Person.BusinessEntityID", "Person.EmailPromotion" ]
7,075
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Please list the credit card IDs of the employees who work as store contact.
SELECT T2.CreditCardID FROM Person AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SC'
store contact refers to PersonType = 'SC';
[ "Person.BusinessEntityID", "Person.PersonType", "PersonCreditCard.BusinessEntityID", "PersonCreditCard.CreditCardID" ]
7,076
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
How many vacation hours do the male employees have on average?
SELECT CAST(SUM(T1.VacationHours) AS REAL) / COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Gender = 'M' AND T2.PersonType = 'EM'
employee refers to PersonType = 'EM'; Male refers to Gender = 'M'; Average = Divide( SUM(VacationHours(PersonType = 'EM'& Gender = 'M')),Count(BusinessEntityID(PersonType = 'EM' & Gender = 'M')));
[ "Employee.BusinessEntityID", "Employee.Gender", "Employee.VacationHours", "Person.BusinessEntityID", "Person.PersonType" ]
7,077
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Among the employees who are married and wish to receive e-mail promotions, how much higher is their highest pay rate from the average pay rate?
SELECT MAX(T1.Rate) - SUM(T1.Rate) / COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Employee AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T2.EmailPromotion = 2 AND T3.MaritalStatus = 'M'
married refers to MaritalStatus = 'M'; Contact does wish to receive e-mail promotions from Adventure Works refers to EmailPromotion = 1; Average = Divide (Sum(Rate (MaritalStatus = 'M' & EmailPromotion = 1))), Count (BusinessEntityID (MaritalStatus = 'M' & EmailPromotion = 1)); MAX(Rate (MaritalStatus = 'M' & EmailProm...
[ "Employee.BusinessEntityID", "Employee.MaritalStatus", "EmployeePayHistory.BusinessEntityID", "EmployeePayHistory.Rate", "Person.BusinessEntityID", "Person.EmailPromotion" ]
7,078
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
If a married employee has a western name style, what is the probability of him or her working as a store contact?
SELECT CAST(COUNT(IIF(T1.PersonType = 'SC', T1.PersonType, NULL)) AS REAL) / COUNT(T1.PersonType) FROM Person AS T1 INNER JOIN Employee AS T2 WHERE T1.PersonType = 'SC' AND T1.NameStyle = 0 AND T2.MaritalStatus = 'M'
married refers to MaritalStatus = 'M'; western name style refers to NameStyle = 0; store contact refers to PersonType = 'SC'; probability = Divide (Count (BusinessEntityID( PersonType = 'SC' & MaritalStatus = 'M')), Count (BusinessEntityID ( PersonType) & MariatlStatus = 'M'))
[ "Employee.MaritalStatus", "Person.NameStyle", "Person.PersonType" ]
7,079
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Among the active employees with over 10 hours of sick leave, what is the percentage of the employees with over 20 vacation hours?
SELECT CAST(SUM(CASE WHEN T2.VacationHours > 20 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.SickLeaveHours > 10
CurrentFlag = 1 refers to the active status of employees; Percentage = Divide (Count (BusinessEntityID (CurrentFlag = 1 & VacationHours >20 & SickLeaveHours > 10)), Count (BusinessEntityID (CurrentFlag = 1 & SickLeaveHours>10))) * 100;
[ "Employee.BusinessEntityID", "Employee.CurrentFlag", "Employee.SickLeaveHours", "Employee.VacationHours", "EmployeePayHistory.BusinessEntityID" ]
7,080
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Average of the last receipt cost of the products whose average lead time is 60 days.
SELECT SUM(LastReceiptCost) / COUNT(ProductID) FROM ProductVendor WHERE AverageLeadTime = 60
average = DIVIDE(SUM(lastreceiptcost), COUNT(OnorderQty)) where AverageLeadTime = 60
[ "ProductVendor.AverageLeadTime", "ProductVendor.LastReceiptCost", "ProductVendor.ProductID" ]
7,081
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Average cost of purchase orders made during the first six months of 2012.
SELECT CAST(SUM(ActualCost) AS REAL) / COUNT(TransactionID) FROM TransactionHistoryArchive WHERE TransactionType = 'P' AND TransactionDate >= '2012-01-01' AND TransactionDate < '2012-07-01'
purchase orders refers to TransactionType = 'P'; first six months of 2012 refers to TransactionDate bewteen '2012-01-01'and '2012-06-30'; average = DIVIDE(ActualCost where TransactionType = 'P', count(TransactionID))
[ "TransactionHistoryArchive.ActualCost", "TransactionHistoryArchive.TransactionDate", "TransactionHistoryArchive.TransactionID", "TransactionHistoryArchive.TransactionType" ]
7,082
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What percentage of male employees hired throughout the years 2009 are married?
SELECT CAST(SUM(CASE WHEN MaritalStatus = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(BusinessEntityID) FROM Employee WHERE SUBSTR(HireDate, 1, 4) = '2009' AND Gender = 'M'
male refers to Gender = 'M'; hired throughout the years 2009 refers to Year(HireDate) = 2009; married refers to MaritalStatus = 'M'; percentage = DIVIDE(count(BusinessEntityID(Gender = 'M'& Year(HireDate) = '2009& MaritalStatus = 'M')), count(BusinessEntityID(Gender = 'M'& Year(HireDate) = 2009)))
[ "Employee.BusinessEntityID", "Employee.Gender", "Employee.HireDate", "Employee.MaritalStatus" ]
7,083
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What percentage of people named Mary who wants Receive Email promotions of AdventureWorks and selected partners are store contacts?
SELECT CAST(SUM(CASE WHEN EmailPromotion = 2 THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN PersonType = 'SC' THEN 1 ELSE 0 END) FROM Person WHERE FirstName = 'Mary'
wants Receive Email promotions of AdventureWorks and selected partners refers to EmailPromotion = 2; store contact refers to PersonType = 'SC'; percentage = DIVIDE(count(BusinessEntityID(FirstName = 'Marry'&EmailPromotion = '2')),count(BusinessEntityID)))
[ "Person.EmailPromotion", "Person.FirstName", "Person.PersonType" ]
7,084
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
List, by ProductID, all products whose profit, relative to the standard price, is negative.
SELECT DISTINCT ProductID FROM ProductVendor WHERE StandardPrice - LastReceiptCost < 0
Profit = SUBTRACT(StandardPrice, LastRecipeCost)
[ "ProductVendor.LastReceiptCost", "ProductVendor.ProductID", "ProductVendor.StandardPrice" ]
7,085
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the average total due price of products with approved status?
SELECT SUM(TotalDue) / COUNT(TotalDue) FROM PurchaseOrderHeader WHERE Status = 2
approved refers to Status = 2 , average total due price = AVG( DIVIDE(TotalDue, SUM(Status = 2 )))
[ "PurchaseOrderHeader.Status", "PurchaseOrderHeader.TotalDue" ]
7,086
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the percentage, by number of sales order units, for orders with quantities not greater than 3 and a discount of 0.2?
SELECT CAST(SUM(CASE WHEN OrderQty < 3 AND UnitPriceDiscount = 0.2 THEN 1 ELSE 0 END) AS REAL) / COUNT(SalesOrderID) FROM SalesOrderDetail
quantities not greater than 3 refers to OrderQty<3; discount of 0.2 refers to UnitPriceDiscount = 0.2; percentage = DIVIDE(count(SalesOrderID(OrderQty<3 & UnitPriceDiscount = 0.2)), count(SalesOrderID))*100%
[ "SalesOrderDetail.OrderQty", "SalesOrderDetail.SalesOrderID", "SalesOrderDetail.UnitPriceDiscount" ]
7,087
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Lists all companies by BusinessEntityID that increased their current year sales by more than 60% over last year's sales and have a bonus greater than 3,000.
SELECT BusinessEntityID FROM SalesPerson WHERE SalesYTD > SalesLastYear + SalesLastyear * 0.6 AND Bonus > 3000
increased their current year sales by more than 60% refers to DIVIDE(SUBTRACT(SalesYTD, SalesLastYear),SalesLastYear)>0.6
[ "SalesPerson.Bonus", "SalesPerson.BusinessEntityID", "SalesPerson.SalesLastYear", "SalesPerson.SalesLastyear", "SalesPerson.SalesYTD" ]
7,088
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Add the number of businesses that indicate their home address as their address and those whose address corresponds to the shipping address.
SELECT SUM(CASE WHEN T2.Name = 'Home' THEN 1 ELSE 0 END) , SUM(CASE WHEN T2.Name = 'Shipping' THEN 1 ELSE 0 END) FROM BusinessEntityAddress AS T1 INNER JOIN AddressType AS T2 ON T1.AddressTypeID = T2.AddressTypeID
their home address as their address refers to AddressTypeID = 2; address corresponds to the shipping address refers to AddressTypeID = 5
[ "AddressType.AddressTypeID", "AddressType.Name", "BusinessEntityAddress.AddressTypeID" ]
7,089
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Identifies the ID number of the customer whose sales order for 32 units had a unit price of 35.
SELECT T2.CustomerID FROM SalesOrderDetail AS T1 INNER JOIN Customer AS T2 WHERE T1.UnitPrice = 35 AND T1.OrderQty = 32
sales order for 32 units refers to OrderQty = 32
[ "Customer.CustomerID", "SalesOrderDetail.OrderQty", "SalesOrderDetail.UnitPrice" ]
7,090
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What company has a Colonial Voice card that expired in March 2005?
SELECT T2.BusinessEntityID FROM CreditCard AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID WHERE T1.CardType = 'ColonialVoice' AND T1.ExpMonth = 3 AND T1.ExpYear = 2005
Colonial Voice card refers to CardType = 'ColonialVoice' ; expired in March 2005 refers to ExpMonth = 3, ExpYear = 2005
[ "CreditCard.CardType", "CreditCard.CreditCardID", "CreditCard.ExpMonth", "CreditCard.ExpYear", "PersonCreditCard.BusinessEntityID", "PersonCreditCard.CreditCardID" ]
7,091
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the credit rating of the company whose average lead time is 16 days for a standard price of 18.9900 and whose last receipt date is August 27, 2011?
SELECT T2.CreditRating FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.StandardPrice = 18.9900 AND T1.AverageLeadTime = 16 AND STRFTIME('%Y-%m-%d', T1.LastReceiptDate) = '2011-08-27'
last receipt date is August 17, 2011 refers to LastReceiptDate> = '2011-08-17 00:00:00' and LastReceiptDate < '2011-08-18 00:00:00';
[ "ProductVendor.AverageLeadTime", "ProductVendor.BusinessEntityID", "ProductVendor.LastReceiptDate", "ProductVendor.StandardPrice", "Vendor.BusinessEntityID", "Vendor.CreditRating" ]
7,092
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Calculate the number of products if we add the products of the accessories and components categories.
SELECT COUNT(ProductID) FROM Product WHERE Name LIKE '%accessories %' OR Name LIKE '%components%'
[ "Product.Name", "Product.ProductID" ]
7,093
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What is the job title of the newest employee in department 12?
SELECT T1.JobTitle FROM Employee AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.DepartmentID = 12 ORDER BY T2.StartDate DESC LIMIT 1
newest employee refers to MAX(StartDate)
[ "Employee.BusinessEntityID", "Employee.JobTitle", "EmployeeDepartmentHistory.BusinessEntityID", "EmployeeDepartmentHistory.DepartmentID", "EmployeeDepartmentHistory.StartDate" ]
7,094
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
List the first and last name of all unmarried male Production Supervisors.
SELECT T2.FirstName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.MaritalStatus = 'S' AND T1.Gender = 'M' AND T1.JobTitle LIKE 'Production Supervisor%'
unmarried refers to MaritalStatus = 'S', male refers to Gender = 'M', Production Supervisors is a job title
[ "Employee.BusinessEntityID", "Employee.Gender", "Employee.JobTitle", "Employee.MaritalStatus", "Person.BusinessEntityID", "Person.FirstName", "Person.LastName" ]
7,095
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
How many products are there if we add all those located in the Subassembly category?
SELECT COUNT(T1.LocationID) FROM Location AS T1 INNER JOIN ProductInventory AS T2 USING (LocationID) WHERE T1.Name = 'Subassembly'
located in the Subassembly category refers to Name = 'Subassembly'
[ "Location.LocationID", "Location.Name" ]
7,096
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Sum the total number of products rejected for having a trim length that is too long.
SELECT SUM(T2.ScrappedQty) FROM ScrapReason AS T1 INNER JOIN WorkOrder AS T2 ON T1.ScrapReasonID = T2.ScrapReasonID WHERE T1.Name = 'Trim length too long'
number of product rejected refers to ScrapedQty; trim length that is too long refers to scrap reason where Name = 'Trim length too long'
[ "ScrapReason.Name", "ScrapReason.ScrapReasonID", "WorkOrder.ScrapReasonID", "WorkOrder.ScrappedQty" ]
7,097
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
Calculate the total quantity of purchased product that has been prepared by employee number 257 and is in pending shipment status.
SELECT SUM(T2.OrderQty) FROM PurchaseOrderHeader AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.PurchaseOrderID = T2.PurchaseOrderID WHERE T1.Status = 1
employee number 257 refers to EmployeeID = 257; pending shipment status refers to Status = 3
[ "PurchaseOrderDetail.OrderQty", "PurchaseOrderDetail.PurchaseOrderID", "PurchaseOrderHeader.PurchaseOrderID", "PurchaseOrderHeader.Status" ]
7,098
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
If we discount the products that do not have any type of offer, how many different products have been sold in an amount greater than 2 units per order?
SELECT COUNT(DISTINCT T1.ProductID) FROM SalesOrderDetail AS T1 INNER JOIN SpecialOfferProduct AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID INNER JOIN SpecialOffer AS T3 ON T2.SpecialOfferID = T3.SpecialOfferID WHERE T1.OrderQty > 2 AND T1.UnitPriceDiscount = 0
do not have any type of offer refers to Description = 'No Discount'; sold in an amount greater than 2 refers to OrderQty>2
[ "SalesOrderDetail.OrderQty", "SalesOrderDetail.ProductID", "SalesOrderDetail.SpecialOfferID", "SalesOrderDetail.UnitPriceDiscount", "SpecialOffer.SpecialOfferID", "SpecialOfferProduct.SpecialOfferID" ]
7,099
works_cycles
CREATE TABLE sqlite_sequence(name,seq); CREATE TABLE CountryRegion ( CountryRegionCode TEXT not null primary key, Name TEXT not null unique, ModifiedDate DATETIME default current_timestamp not null ); CREATE TABLE Cultur...
What type of transaction was made with the only yellow product, size 62 and with a minimum inventory stock of 500 units?
SELECT DISTINCT T2.TransactionType FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Size = 62 AND T1.Color = 'Yellow' AND T1.SafetyStockLevel = 500
yellow product refers to Color = 'Yellow'; minimum inventory stock of 500 units refers to SafetyStockLevel = 500
[ "Product.Color", "Product.ProductID", "Product.SafetyStockLevel", "Product.Size", "TransactionHistory.ProductID", "TransactionHistory.TransactionType" ]