Chinastark/bird_dataset huggingface dataset:
Database: works_cycles
Question: Among the active male employees, how many of them are paid with the highest frequency?
Evidence: active status of employees refers to CurrentFlag = 1; Male refers to Gender = 'M'; highest frequency refers to PayFrequency = 2;
SQL: 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
Database: works_cycles
Question: How many male employees have the job position of sales person?
Evidence: Sales person refers to PersonType = 'SP'; Male refers to Gender = 'M';
SQL: 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'
Database: works_cycles
Question: What is the job position of the oldest employee?
Evidence: Oldest employee refers to Max ( Subtract((now())-BirthDate));
SQL: SELECT T2.PersonType FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.BirthDate ASC LIMIT 1
Database: works_cycles
Question: What is the name style of the employee with the lowest pay rate?
Evidence: lowest pay rate refers to Min(Rate);
SQL: 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
Database: works_cycles
Question: Among the employees who are married, how many of them have a western name style?
Evidence: married refers to MaritalStatus = 'M'; western name style refers to NameStyle = '0';
SQL: 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'
Database: works_cycles
Question: Among the employees who have more than 10 hours of sick leave, how many of them wish to receive e-mail promotions?
Evidence: Contact does wish to receive e-mail promotions refers to EmailPromotion = (1,2); more than 10 hours of sick leave refer to SickLeaveHours >10;
SQL: 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
Database: works_cycles
Question: Please list the employees who have more than 20 vacations hours and wish to receive e-mail promotions.
Evidence: Contact does wish to receive e-mail promotions refers to EmailPromotion = (1,2); more than 20 vacations hours refers to VacationHours>20
SQL: 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
Database: works_cycles
Question: Please give the additional contact information of the oldest employee with the jod position of sales person.
Evidence: Sales person refers to PersonType = 'SP'; oldest employee refers to Max (Subtract((now())-BirthDate));
SQL: 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
Database: works_cycles
Question: What is the first name of the male employee who has a western name style?
Evidence: western name style refers to NameStyle = 0; Male refers to Gender = 'M';
SQL: 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'
Database: works_cycles
Question: Among the active employees, how many of them have a courtesy title of "Mr"?
Evidence: active status of employees refers to CurrentFlag = 1;
SQL: 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.'
Database: works_cycles
Question: Please give the personal information of the married employee who has the highest pay rate.
Evidence: married refers to MaritalStatus = 'M'; Highest pay rate refers to Max(Rate)
SQL: 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
Database: works_cycles
Question: What is the surname suffix of the employee who works as a store contact and has the longest sick leave hours?
Evidence: store contact refers to PersonType = 'SC';
SQL: 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
Database: works_cycles
Question: Among the married employees with the highest pay frequency, how many of them have an eastern name style?
Evidence: married refers to MaritalStatus = 'M'; Eastern name style refers to NameStyle = 1;
SQL: 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 DESC LIMIT 1 )
Database: works_cycles
Question: How many active employees do not wish to receive e-mail promotions?
Evidence: active status of employees refers to CurrentFlag = 1; the employee does not wish to receive an e-mail promotion refers to EmailPromotion = 0;
SQL: 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
Database: works_cycles
Question: Please list the credit card IDs of the employees who work as store contact.
Evidence: store contact refers to PersonType = 'SC';
SQL: SELECT T2.CreditCardID FROM Person AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SC'
Database: works_cycles
Question: How many vacation hours do the male employees have on average?
Evidence: employee refers to PersonType = 'EM'; Male refers to Gender = 'M'; Average = Divide( SUM(VacationHours(PersonType = 'EM'& Gender = 'M')),Count(BusinessEntityID(PersonType = 'EM' & Gender = 'M')));
SQL: 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'
Database: works_cycles
Question: 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?
Evidence: 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' & EmailPromotion = 1) - Average;
SQL: 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'
Database: works_cycles
Question: If a married employee has a western name style, what is the probability of him or her working as a store contact?
Evidence: 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'))

SQL: 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'
Database: works_cycles
Question: Among the active employees with over 10 hours of sick leave, what is the percentage of the employees with over 20 vacation hours?
Evidence: 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;
SQL: 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
Database: works_cycles
Question: Average of the last receipt cost of the products whose average lead time is 60 days.
Evidence: average = DIVIDE(SUM(lastreceiptcost), COUNT(OnorderQty)) where AverageLeadTime = 60
SQL: SELECT SUM(LastReceiptCost) / COUNT(ProductID) FROM ProductVendor WHERE AverageLeadTime = 60
Database: works_cycles
Question: Average cost of purchase orders made during the first six months of 2012.
Evidence: 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))

SQL: SELECT CAST(SUM(ActualCost) AS REAL) / COUNT(TransactionID) FROM TransactionHistoryArchive WHERE TransactionType = 'P' AND TransactionDate >= '2012-01-01' AND TransactionDate < '2012-07-01'
Database: works_cycles
Question: What percentage of male employees hired throughout the years 2009 are married?
Evidence: 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)))


SQL: 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'
Database: works_cycles
Question: What percentage of people named Mary who wants Receive Email promotions of AdventureWorks and selected partners are store contacts?
Evidence: 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)))

SQL: 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'
Database: works_cycles
Question: List, by ProductID, all products whose profit, relative to the standard price, is negative.
Evidence: Profit = SUBTRACT(StandardPrice, LastRecipeCost)

SQL: SELECT DISTINCT ProductID FROM ProductVendor WHERE StandardPrice - LastReceiptCost < 0
Database: works_cycles
Question: What is the average total due price of products with approved status?
Evidence: approved refers to Status = 2 , average total due price = AVG( DIVIDE(TotalDue, SUM(Status = 2 )))
SQL: SELECT SUM(TotalDue) / COUNT(TotalDue) FROM PurchaseOrderHeader WHERE Status = 2
Database: works_cycles
Question: What is the percentage, by number of sales order units, for orders with quantities not greater than 3 and a discount of 0.2?
Evidence: 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%
SQL: SELECT CAST(SUM(CASE WHEN OrderQty < 3 AND UnitPriceDiscount = 0.2 THEN 1 ELSE 0 END) AS REAL) / COUNT(SalesOrderID) FROM SalesOrderDetail
Database: works_cycles
Question: 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.
Evidence: increased their current year sales by more than 60% refers to
DIVIDE(SUBTRACT(SalesYTD, SalesLastYear),SalesLastYear)>0.6
SQL: SELECT BusinessEntityID FROM SalesPerson WHERE SalesYTD > SalesLastYear + SalesLastyear * 0.6 AND Bonus > 3000
Database: works_cycles
Question: Add the number of businesses that indicate their home address as their address and those whose address corresponds to the shipping address.
Evidence: their home address as their address refers to AddressTypeID = 2; address corresponds to the shipping address refers to AddressTypeID = 5
SQL: 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
Database: works_cycles
Question: Identifies the ID number of the customer whose sales order for 32 units had a unit price of 35.
Evidence: sales order for 32 units refers to OrderQty = 32
SQL: SELECT T2.CustomerID FROM SalesOrderDetail AS T1 INNER JOIN Customer AS T2 WHERE T1.UnitPrice = 35 AND T1.OrderQty = 32
Database: works_cycles
Question: What company has a Colonial Voice card that expired in March 2005?
Evidence: Colonial Voice card refers to CardType = 'ColonialVoice' ; expired in March 2005 refers to ExpMonth = 3, ExpYear = 2005
SQL: 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
Database: works_cycles
Question: 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?
Evidence: last receipt date is August 17, 2011 refers to LastReceiptDate> = '2011-08-17 00:00:00' and LastReceiptDate < '2011-08-18 00:00:00';
SQL: 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'
Database: works_cycles
Question: Calculate the number of products if we add the products of the accessories and components categories.
SQL: SELECT COUNT(ProductID) FROM Product WHERE Name LIKE '%accessories %' OR Name LIKE '%components%'
Database: works_cycles
Question: What is the job title of the newest employee in department 12?
Evidence: newest employee refers to MAX(StartDate)
SQL: 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
Database: works_cycles
Question: List the first and last name of all unmarried male Production Supervisors.
Evidence: unmarried refers to MaritalStatus = 'S', male refers to Gender = 'M', Production Supervisors is a job title
SQL: 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%'
Database: works_cycles
Question: How many products are there if we add all those located in the Subassembly category?
Evidence: located in the Subassembly category refers to Name = 'Subassembly'
SQL: SELECT COUNT(T1.LocationID) FROM Location AS T1 INNER JOIN ProductInventory AS T2 USING (LocationID) WHERE T1.Name = 'Subassembly'
Database: works_cycles
Question: Sum the total number of products rejected for having a trim length that is too long.
Evidence: number of product rejected refers to ScrapedQty; trim length that is too long refers to scrap reason where Name = 'Trim length too long'
SQL: 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'
Database: works_cycles
Question: Calculate the total quantity of purchased product that has been prepared by employee number 257 and is in pending shipment status.
Evidence: employee number 257 refers to EmployeeID = 257; pending shipment status refers to Status = 3
SQL: SELECT SUM(T2.OrderQty) FROM PurchaseOrderHeader AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.PurchaseOrderID = T2.PurchaseOrderID WHERE T1.Status = 1
Database: works_cycles
Question: 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?
Evidence: do not have any type of offer refers to Description = 'No Discount'; sold in an amount greater than 2 refers to OrderQty>2
SQL: 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
Database: works_cycles
Question: What type of transaction was made with the only yellow product, size 62 and with a minimum inventory stock of 500 units?
Evidence: yellow product refers to Color = 'Yellow'; minimum inventory stock of 500 units refers to SafetyStockLevel = 500
SQL: 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
Database: works_cycles
Question: What is the name of the subcategory to which the gray product with the lowest safety stock level belongs?
Evidence: gray is color of product
SQL: SELECT T1.Name FROM ProductSubcategory AS T1 INNER JOIN Product AS T2 USING (ProductSubcategoryID) WHERE T2.Color = 'Grey' GROUP BY T1.Name
Database: works_cycles
Question: What is the product cost end date with the highest weight in grams?
Evidence: in grams refers to WeightUnitMeasureCode = 'G'
SQL: SELECT T2.EndDate FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.WeightUnitMeasureCode = 'G' ORDER BY T1.Weight DESC LIMIT 1
Database: works_cycles
Question: What is the percentage of the total products ordered were not rejected by Drill size?
Evidence: rejected quantity refers to ScrappedQty; rejected by Drill size refers to Name in ('Drill size too small','Drill size too large'); percentage = DIVIDE(SUM(ScrappedQty) where Name in('Drill size too small','Drill size too large'), OrderQty)
SQL: 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
Database: works_cycles
Question: Calculate the average of the total ordered quantity of products purchased whose shipping method was Cargo Transport 5.
Evidence: shipping method was Cargo Transport 5 refers to Name = 'Cargo Transport 5'; average = DIVIDE(SUM(OrderQty where Name = 'Cargo Transport 5'), COUNT(ShipMethodID))
SQL: SELECT CAST(SUM(IIF(T1.ShipMethodID = 5, T3.OrderQty, 0)) AS REAL) / COUNT(T3.ProductID) FROM ShipMethod AS T1 INNER JOIN PurchaseOrderHeader AS T2 ON T1.ShipMethodID = T2.ShipMethodID INNER JOIN PurchaseOrderDetail AS T3 ON T2.PurchaseOrderID = T3.PurchaseOrderID
Database: works_cycles
Question: List the name of the rates that apply to the provinces that are in the territory that obtained the greatest increase in sales with respect to the previous year.
Evidence: sales of previous year refers to SalesLastYear; SalesYTD refers to year to date sales; increase in sales = DIVIDE(SUBTRACT(SalesYTD, SalesLastYear), SalesLastYear)*100
SQL: SELECT T2.Name FROM SalesTerritory AS T1 INNER JOIN StateProvince AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode INNER JOIN SalesTaxRate AS T3 ON T2.StateProvinceID = T3.StateProvinceID ORDER BY (T1.SalesYTD - T1.SalesLastYear) / T1.SalesLastYear DESC LIMIT 1
Database: works_cycles
Question: How many employees earn their salaries on a monthly basis at an hourly rate of more than 50?
Evidence: employee refers to BusinessEntityID; salaries on a monthly basis refers to PayFrequency = 1; hourly rate more than 50 refers to Rate > 50
SQL: SELECT COUNT(BusinessEntityID) FROM EmployeePayHistory WHERE rate * PayFrequency > 50
Database: works_cycles
Question: What is the employee of company number 1's full name?
Evidence: company number 1 refers to BusinessEntityId = 1; employee refers to PersonType = 'EM'; full name refers to FirstName + MiddleName + LastName
SQL: SELECT FirstName, MiddleName, LastName FROM Person WHERE BusinessEntityID = 1 AND PersonType = 'EM'
Database: works_cycles
Question: What is the name of the supplier number 1492?
Evidence: supplier number 1492 refers to BusinessEntityId = 1492; name of the supplier = name from vendor
SQL: SELECT NAME FROM Vendor WHERE BusinessEntityID = 1492
Database: works_cycles
Question: How many vendors only consented to move on with the 500 to 15000 piece order in terms of quality?
Evidence: Vendor refers to BusinessEntityId; 500 to 15000 piece order refers to MinOrderQty > 500 and MaxOrderQty < 15000
SQL: SELECT COUNT(*) FROM ProductVendor WHERE MinOrderQty > 500 AND MaxOrderQty < 15000
Database: works_cycles
Question: Please list the departments that are part of the Executive General and Administration group.
Evidence: Department refers to Name where GroupName = 'Executive General and Administration'
SQL: SELECT Name FROM Department WHERE GroupName = 'Executive General and Administration'
Database: works_cycles
Question: Please list the family names of any employees whose middle names begin with C.
Evidence: family names refers to Last name; employee refers to PersonType = 'EM'; MiddleName starts with 'C'
SQL: SELECT LastName FROM Person WHERE PersonType = 'EM' AND MiddleName LIKE 'C%'
Database: works_cycles
Question: How many vendors are having their products ordered with an average delivery time of 25 days?
Evidence: vendors refers to distinct BusinessEntityID; average delivery time of 25 days refers to AverageLeadTime = 25 and onOrderQty > 0
SQL: SELECT COUNT(DISTINCT BusinessEntityID) FROM ProductVendor WHERE AverageLeadTime = 25
Database: works_cycles
Question: Please list any 3 product numbers with the lowest standard cost.
Evidence: product number = productID
SQL: SELECT ProductID FROM ProductCostHistory ORDER BY StandardCost ASC LIMIT 3
Database: works_cycles
Question: How many black-colored products are there that cannot be sold?
Evidence: cannot be sold means product is not a salable item which refers to FinishedGoodsFlag = 0
SQL: SELECT COUNT(ProductID) FROM Product WHERE FinishedGoodsFlag = 0 AND Color = 'Black'
Database: works_cycles
Question: Please list the top three employees with the most unused sick leave along with their position titles.
Evidence: employees refers to BusinessEntityID; most unused sick leave refers to MAX(SickLeaveHours); position title refers to JobTitle
SQL: SELECT JobTitle FROM Employee ORDER BY SickLeaveHours DESC LIMIT 3
Database: works_cycles
Question: What is the full address of address number 11906?
Evidence: address number refers to AddressID; full address refers to AddressLine1 + AddressLine2
SQL: SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID = 11906
Database: works_cycles
Question: What is business number 1580's net profit?
Evidence: business number 1580 refers to BusinessEntityID = 1580; Net profit = SUBTRACT(LastReceiptCost,StandardPrice)
SQL: SELECT LastReceiptCost - StandardPrice FROM ProductVendor WHERE BusinessEntityID = 1580
Database: works_cycles
Question: What is the sales revenue for item number 740?
Evidence: business number 1580 refers to BusinessEntityID = 1580; Net profit = SUBTRACT(LastReceiptCost,StandardPrice)
SQL: SELECT ListPrice - StandardCost FROM Product WHERE ProductID = 740
Database: works_cycles
Question: How many customers gave a product the best possible rating? Please list their names.
Evidence: customers' name refers to ReviewerName; best possible ratings means the highest rating = 5
SQL: SELECT ReviewerName FROM ProductReview WHERE Rating = 5