db_id
stringclasses
69 values
question
stringlengths
24
325
evidence
stringlengths
0
673
SQL
stringlengths
23
804
works_cycles
What is the name of the subcategory to which the gray product with the lowest safety stock level belongs?
gray is color of product
SELECT T1.Name FROM ProductSubcategory AS T1 INNER JOIN Product AS T2 USING (ProductSubcategoryID) WHERE T2.Color = 'Grey' GROUP BY T1.Name
works_cycles
What is the product cost end date with the highest weight in grams?
in grams refers to WeightUnitMeasureCode = 'G'
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
works_cycles
What is the percentage of the total products ordered were not rejected by Drill size?
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)
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
works_cycles
Calculate the average of the total ordered quantity of products purchased whose shipping method was Cargo Transport 5.
shipping method was Cargo Transport 5 refers to Name = 'Cargo Transport 5'; average = DIVIDE(SUM(OrderQty where Name = 'Cargo Transport 5'), COUNT(ShipMethodID))
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
works_cycles
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.
sales of previous year refers to SalesLastYear; SalesYTD refers to year to date sales; increase in sales = DIVIDE(SUBTRACT(SalesYTD, SalesLastYear), SalesLastYear)*100
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
works_cycles
How many employees earn their salaries on a monthly basis at an hourly rate of more than 50?
employee refers to BusinessEntityID; salaries on a monthly basis refers to PayFrequency = 1; hourly rate more than 50 refers to Rate > 50
SELECT COUNT(BusinessEntityID) FROM EmployeePayHistory WHERE rate * PayFrequency > 50
works_cycles
What is the employee of company number 1's full name?
company number 1 refers to BusinessEntityId = 1; employee refers to PersonType = 'EM'; full name refers to FirstName + MiddleName + LastName
SELECT FirstName, MiddleName, LastName FROM Person WHERE BusinessEntityID = 1 AND PersonType = 'EM'
works_cycles
What is the name of the supplier number 1492?
supplier number 1492 refers to BusinessEntityId = 1492; name of the supplier = name from vendor
SELECT NAME FROM Vendor WHERE BusinessEntityID = 1492
works_cycles
How many vendors only consented to move on with the 500 to 15000 piece order in terms of quality?
Vendor refers to BusinessEntityId; 500 to 15000 piece order refers to MinOrderQty > 500 and MaxOrderQty < 15000
SELECT COUNT(*) FROM ProductVendor WHERE MinOrderQty > 500 AND MaxOrderQty < 15000
works_cycles
Please list the departments that are part of the Executive General and Administration group.
Department refers to Name where GroupName = 'Executive General and Administration'
SELECT Name FROM Department WHERE GroupName = 'Executive General and Administration'
works_cycles
Please list the family names of any employees whose middle names begin with C.
family names refers to Last name; employee refers to PersonType = 'EM'; MiddleName starts with 'C'
SELECT LastName FROM Person WHERE PersonType = 'EM' AND MiddleName LIKE 'C%'
works_cycles
How many vendors are having their products ordered with an average delivery time of 25 days?
vendors refers to distinct BusinessEntityID; average delivery time of 25 days refers to AverageLeadTime = 25 and onOrderQty > 0
SELECT COUNT(DISTINCT BusinessEntityID) FROM ProductVendor WHERE AverageLeadTime = 25
works_cycles
Please list any 3 product numbers with the lowest standard cost.
product number = productID
SELECT ProductID FROM ProductCostHistory ORDER BY StandardCost ASC LIMIT 3
works_cycles
How many black-colored products are there that cannot be sold?
cannot be sold means product is not a salable item which refers to FinishedGoodsFlag = 0
SELECT COUNT(ProductID) FROM Product WHERE FinishedGoodsFlag = 0 AND Color = 'Black'
works_cycles
Please list the top three employees with the most unused sick leave along with their position titles.
employees refers to BusinessEntityID; most unused sick leave refers to MAX(SickLeaveHours); position title refers to JobTitle
SELECT JobTitle FROM Employee ORDER BY SickLeaveHours DESC LIMIT 3
works_cycles
What is the full address of address number 11906?
address number refers to AddressID; full address refers to AddressLine1 + AddressLine2
SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID = 11906
works_cycles
What is business number 1580's net profit?
business number 1580 refers to BusinessEntityID = 1580; Net profit = SUBTRACT(LastReceiptCost,StandardPrice)
SELECT LastReceiptCost - StandardPrice FROM ProductVendor WHERE BusinessEntityID = 1580
works_cycles
What is the sales revenue for item number 740?
business number 1580 refers to BusinessEntityID = 1580; Net profit = SUBTRACT(LastReceiptCost,StandardPrice)
SELECT ListPrice - StandardCost FROM Product WHERE ProductID = 740
works_cycles
How many customers gave a product the best possible rating? Please list their names.
customers' name refers to ReviewerName; best possible ratings means the highest rating = 5
SELECT ReviewerName FROM ProductReview WHERE Rating = 5
works_cycles
What are the company that Adventure Works deal with that have poor credit rating? Please provide their business number.
poor credit rating means bad credit; CreditRating = 5; Business number refers to BusinessEntityID
SELECT BusinessEntityID FROM Vendor WHERE CreditRating = ( SELECT CreditRating FROM Vendor ORDER BY CreditRating DESC LIMIT 1 )
works_cycles
What is the forename and birthdate of person number 18?
person number 18 refers to BusinessEntityID = 18; forename refers to FirstName
SELECT T1.FirstName, T2.BirthDate FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.BusinessEntityID = 18
works_cycles
What job is person number 322 currently holding?
person number 322 refers to PersonID = 18; job is the name of contacttype
SELECT T1.Name FROM ContactType AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.ContactTypeID = T2.ContactTypeID WHERE T2.BusinessEntityID = 332
works_cycles
Please list 3 businesses along with their IDs that use cellphones.
business along with their IDs = BusinessEntityID; Cellphones refers to PhoneNumberType.name = ‘cell’
SELECT T2.BusinessEntityID FROM PhoneNumberType AS T1 INNER JOIN PersonPhone AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID WHERE T1.Name = 'Cell' LIMIT 3
works_cycles
What is the currency of Brazil?
SELECT T1.Name FROM Currency AS T1 INNER JOIN CountryRegionCurrency AS T2 ON T1.CurrencyCode = T2.CurrencyCode INNER JOIN CountryRegion AS T3 ON T2.CountryRegionCode = T3.CountryRegionCode WHERE T3.Name = 'Brazil'
works_cycles
How many people work in the finance department?
SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID WHERE T1.Name = 'Finance'
works_cycles
How long does it take for the business to receive the item it has purchased? Who is the vendor for business number 1496?
business number refers to BusinessEntityID where BusinessEntityID = 1496; how long does it take refers to AverageLeadTime
SELECT T1.AverageLeadTime, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 USING (businessentityid) WHERE T2.BusinessEntityID = 1496 GROUP BY T1.AverageLeadTime, T2.Name
works_cycles
How many accounts are in Bothell as opposed to Kenmore? What is the name of the State that comprises these two cities?
SUBTRACT(count(city = 'Bothell'), count(city = 'Kenmore'))
SELECT SUM(IIF(T1.city = 'Bothell', 1, 0)) - SUM(IIF(T1.city = 'Kenmore', 1, 0)) , stateprovincecode FROM Address AS T1 INNER JOIN StateProvince AS T2 ON T1.stateprovinceid = T2.stateprovinceid GROUP BY stateprovincecode
works_cycles
Which chromoly steel product model has AdventureWorks saved in English?
Saved in English refers to product description written in English where Culture.name = 'English'
SELECT T1.ProductModelID FROM ProductModelProductDescriptionCulture AS T1 INNER JOIN Culture AS T2 USING (cultureid) INNER JOIN ProductDescription AS T3 USING (productdescriptionid) WHERE T3.Description LIKE 'Chromoly steel%' AND T2.Name = 'English'
works_cycles
Please list the total number of companies with a commission percentage of 0.018 or above, along with each company's assigned geographical location.
geographical location refers to group from SalesPerson; ComissionPct refers to commission percentage where ComissionPct > = 0.018;
SELECT T1.BusinessEntityID, T2.'Group' FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 USING (territoryid) WHERE T1.CommissionPct >= 0.018
works_cycles
Please list the various phone number types in the following order, from most to least common among businesses.
SELECT T2.Name FROM PersonPhone AS T1 INNER JOIN PhoneNumberType AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID GROUP BY T2.Name ORDER BY COUNT(T2.Name) DESC
works_cycles
Which role has the most common contact among businesses?
Most common contact among businesses refers to BusinessEntityContact with the most name
SELECT T1.Name FROM ContactType AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.ContactTypeID = T2.ContactTypeID GROUP BY T1.Name ORDER BY COUNT(T1.Name) DESC LIMIT 1
works_cycles
What are the salespeople's email addresses?
Salespeople refers to PersonType = 'SP'
SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SP'
works_cycles
Which position does Suchitra hold?
position refers to JobTitle
SELECT T2.JobTitle FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Suchitra'
works_cycles
How many employees work for AdvertureWorks that is single?
Employees refer to PersonType = 'EM'; Single refers to MaritalStatus = 's'
SELECT COUNT(T1.BusinessentityID) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'EM' AND T2.MaritalStatus = 'S'
works_cycles
How much do the works data saved in English and Arabic differ from one another?
Data saved in English refers to the name of the language where Culture.Name = 'English'; data saved in Arabic refers to the name of the language where Culture.Name = 'Arabic';   SUBTRACT(count(Name = 'English'), count(Name = 'Bothell'))
SELECT SUM(CASE WHEN T1.Name = 'English' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.Name = 'Arabic' THEN 1 ELSE 0 END) FROM Culture AS T1 INNER JOIN ProductModelProductDescriptionCulture AS T2 ON T1.CultureID = T2.CultureID WHERE T1.Name = 'English' OR T1.Name = 'Arabic'
works_cycles
What is the location of business number 1?
Location refers to AddressLine1; business number refers to the BusinessEntityID where BusinessEntityID = 1
SELECT T1.AddressLine1 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 USING (AddressID) WHERE T2.BusinessEntityID = 1
works_cycles
Please list the businesses along with their numbers that have their accounts located in Duvall.
Business along with their numbers refers to the BusinessEntityID; located in Duvall refers to City = 'Duvall'
SELECT T2.BusinessEntityID FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T1.City = 'Duvall'
works_cycles
What percentage of the AdventureWorks data is in Thai?
percentage = DIVIDE(Culture.Name = 'Thai', count(ALL Culture.Name))*100%
SELECT CAST(SUM(CASE WHEN T1.Name = 'Thai' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.CultureID) FROM Culture AS T1 INNER JOIN ProductModelProductDescriptionCulture AS T2 ON T1.CultureID = T2.CultureID
works_cycles
What percentage of AdventureWorks employees are men?
male refers to Gender = 'M'; employee refers to PersonType = 'EM'; percentage = DIVIDE(COUNT(Gender = 'M'), COUNT(PersonType = 'MY'))*100%;
SELECT CAST(SUM(CASE WHEN T2.Gender = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessentityID) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessentityID = T2.BusinessentityID WHERE T1.PersonType = 'EM'
works_cycles
Where is the address 15873 located, in what city and state? Does that city belong to a province where the code exists?
Address number 15873 refers to AddressID = '15873'; IsOnlyStateProvinceCode = '0' refers to StateProvinceCode exists; IsOnlyStateProvinceCode = '1' refers to StateProvinceCode unavailable;
SELECT T2.City, T1.Name, T1.IsOnlyStateProvinceFlag FROM StateProvince AS T1 INNER JOIN Address AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.AddressID = 15873
works_cycles
What is the full address of business number 24?
Full address refers to AddressLine1+AddressLine2; business number 24 refers to BusinessEntityID = '24'
SELECT T1.AddressLine1, T1.AddressLine2 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T2.BusinessEntityID = 24
works_cycles
Which year is credit card No.9648's Expiration Year?
Expiration year refers to ExpYear
SELECT ExpYear FROM CreditCard WHERE CreditCardID = 9648
works_cycles
What's Emma H Harris's Business Entity ID number?
SELECT BusinessEntityID FROM Person WHERE FirstName = 'Emma' AND LastName = 'Harris'
works_cycles
What is the location id for Debur and Polish?
Debur and Polish is name of manufacturing location
SELECT LocationID FROM Location WHERE Name = 'Debur and Polish'
works_cycles
What are the Department ids under the Sales and Marketing Group?
Sales and Marketing is group name of a department
SELECT DepartmentID FROM Department WHERE GroupName = 'Sales and Marketing'
works_cycles
Which sales person made the sale of 1635823.3967 last year? Give the Business Entity ID.
SELECT BusinessEntityID FROM SalesPerson WHERE SalesLastYear = '1635823.3967'
works_cycles
What is the Shift start time for Shift ID No.2?
SELECT StartTime FROM Shift WHERE ShiftID = '2'
works_cycles
What is contact Type ID No.16 represent for?
SELECT Name FROM ContactType WHERE ContactTypeID = '16'
works_cycles
What is the minimum shipping charge for "OVERSEAS - DELUXE"?
Minimum shipping charge refers to ShipBase; OVERSEAS - DELUXE is name of shipping company
SELECT ShipBase FROM ShipMethod WHERE Name = 'OVERSEAS - DELUXE'
works_cycles
Please tell the meaning of CultureID "fr".
tell the meaning is to find the name of culture
SELECT Name FROM Culture WHERE CultureID = 'fr'
works_cycles
Give the Mauritius Rupee's currency code.
Mauritius Rupee is name of currency
SELECT CurrencyCode FROM Currency WHERE Name = 'Mauritius Rupee'
works_cycles
Name cellphone number's Type ID?
Cellphone refers to Name = 'Cell'
SELECT PhoneNumberTypeID FROM PhoneNumberType WHERE Name = 'Cell'
works_cycles
For the older production technician who was hired in 2008/12/7, what's his/her birthday?
Oldest production technician refers to MIN(BirthDate) where JobTitle = 'Production Technician'
SELECT BirthDate FROM Employee WHERE HireDate = '2008-12-07'
works_cycles
What is the product ID No.793's model name?
SELECT T1.Name FROM Product AS T1 INNER JOIN ProductModel AS T2 ON T1.ProductModelID = T2.ProductModelID WHERE T1.ProductID = 793
works_cycles
What are the unit measure codes for product ID No.762?
SELECT T2.UnitMeasureCode FROM Product AS T1 INNER JOIN UnitMeasure AS T2 ON T1.SizeUnitMeasureCode = T2.UnitMeasureCode OR T1.WeightUnitMeasureCode = T2.UnitMeasureCode WHERE T1.ProductID = 762 GROUP BY T1.ProductID, T2.UnitMeasureCode
works_cycles
Where is Business Entity ID No.4 located at? Give the address down to street.
Located refers to the total address of the entity that comprises city, addressline1, addressline2
SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID IN ( SELECT AddressID FROM BusinessEntityAddress WHERE BusinessEntityID = 4 )
works_cycles
For the on going assembly item Component ID No. 494, what's the Unit measure for it?
On going assembly item means the assembly item haven't been finished, therefore EndDate is null
SELECT T2.Name FROM BillOfMaterials AS T1 INNER JOIN UnitMeasure AS T2 ON T1.UnitMeasureCode = T2.UnitMeasureCode WHERE T1.ComponentID = 494 AND T1.EndDate IS NULL GROUP BY T2.name
works_cycles
For the document Control Assistant who was born on 1975/12/25, how many private documents did he/she have?
Document Control Assistant refers to the JobTitle = 'Document Control Assistant'; born on 1975/12/25 refers to BirthDate = '1975-12-25'; private documents indicate that DocumentSummary is null
SELECT COUNT(T2.BusinessEntityID) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.BirthDate = '1975-12-25' AND T1.DocumentSummary IS NULL
works_cycles
To the products which could make the profit as 21.9037, what were their list price after October of 2012?
Profit as 82.41 = SUTRACT(ListPrice, StandardCost); May of 2012 refers to StartDate = '2012-05'
SELECT T1.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ListPrice - T1.StandardCost > 21.9037 AND STRFTIME('%Y-%m-%d', T2.StartDate) >= '2012-10-01'
works_cycles
What is the size of the photo of product id No.1?
SELECT T1.ThumbNailPhoto FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T2.ProductID = 1
works_cycles
How many letters are there in Catherine Ward's e-mail account passwords?
Catherine Ward refers to the name of BusinessEntityID; how many letters in password for the e-mail account refers to LENGTH(PasswordHash)
SELECT LENGTH(T2.PasswordHash) FROM Person AS T1 INNER JOIN Password AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Catherine' AND T1.LastName = 'Ward'
works_cycles
What rating did Jill give for HL Mountain Pedal?
Jill refers to the name of reviewer; HL Mountain Pedal refers to the name of the product
SELECT T1.Rating FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ReviewerName = 'Jill' AND T2.Name = 'HL Mountain Pedal'
works_cycles
What's the profit for the Freewheel?
SUBTRACT(LastReceiptCost, StandardPrice) for ProductID where name = 'Freewheel'
SELECT T1.LastReceiptCost - T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Freewheel'
works_cycles
Did Rachel Valdez complete her sales task?
Complete sales task refers to meeting sales quota; if Bonus = 0, it means this salesperson doesn't meet quota and vice versa
SELECT T1.Bonus FROM SalesPerson AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.FirstName = 'Rachel' AND T2.LastName = 'Valdez'
works_cycles
How many types of tax did the sales happen in Quebec have?
If Name = "+" in the value from SalesTaxRate, it means this sales are charged by multiple types of tax; Quebec refers to the name of State Province
SELECT COUNT(DISTINCT T1.Name) FROM SalesTaxRate AS T1 INNER JOIN StateProvince AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.Name = 'Quebec'
works_cycles
What's Kevin A Wright's email address?
SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Kevin' AND T1.MiddleName = 'A' AND T1.LastName = 'Wright'
works_cycles
What is the number of State Province of France that doesn't have a State Province Code?
Doesn't have a State Province Code refers to IsOnlyStateProvinceFlag = 1 where StateProvinceCode is unavailable
SELECT T1.CountryRegionCode FROM StateProvince AS T1 INNER JOIN CountryRegion AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode WHERE T2.Name = 'France' AND T1.IsOnlyStateProvinceFlag = 1
works_cycles
What kind of transaction type for the "HL Road Frame - Black, 48" order happened in 2012/12/13?
Transactiontype = 'w' means 'WorkOrder'; transactiontype = 's' means 'SalesOrder'; transactiontype = 'P' means 'PurchaseOrder'; happened in refers to TransactionDate
SELECT T1.TransactionType FROM TransactionHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Road Frame - Black, 48' AND STRFTIME('%Y-%m-%d',T1.TransactionDate) = '2013-07-31'
works_cycles
Which type of transaction was it for the "LL Road Handlebars" order happened in 2012/11/3?
Transactiontype = 'w' means 'WorkOrder'; transactiontype = 's' means 'SalesOrder'; transactiontype = 'P' means 'PurchaseOrder'; happened in refers to TransactionDate
SELECT T1.TransactionType FROM TransactionHistoryArchive AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'LL Road Handlebars' AND STRFTIME('%Y-%m-%d',T1.TransactionDate) = '2012-11-03'
works_cycles
How is the Credit Rating for company whose rowguid is "33671A4E-DF2B-4879-807B-E3F930DD5C0C"?
CreditRating = 1 means 'Superior'; CreditRating = 2 means 'Excellent'; CreditRating = 3 means 'Above average'; CreditRating = 4 means 'Superior'; CreditRating = 5 means 'Below average'
SELECT T1.CreditRating FROM Vendor AS T1 INNER JOIN BusinessEntity AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.rowguid = '33671A4E-DF2B-4879-807B-E3F930DD5C0C'
works_cycles
What is the PreferredVendorStatus for the company which has the rowguid of "684F328D-C185-43B9-AF9A-37ACC680D2AF"?
PreferredVendorStatus = 1 means 'Do not use if another vendor is available'; CreditRating = 2 means 'Preferred over other vendors supplying the same product'
SELECT T1.PreferredVendorStatus FROM Vendor AS T1 INNER JOIN BusinessEntity AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.rowguid = '684F328D-C185-43B9-AF9A-37ACC680D2AF'
works_cycles
For person id No.2054, is his/her vendor still active?
ActiveFlag = 1 means 'Vendor no longer used'; ActiveFlag = 2 means 'Vendor is actively used
SELECT T1.ActiveFlag FROM Vendor AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonID = 2054
works_cycles
Show me the phone number of Gerald Patel's.
SELECT T2.PhoneNumber FROM Person AS T1 INNER JOIN PersonPhone AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Gerald' AND T1.LastName = 'Patel'
works_cycles
Which is Business Entity ID No.13626's phone number type?
SELECT T2.Name FROM PersonPhone AS T1 INNER JOIN PhoneNumberType AS T2 USING (PhoneNumberTypeID) WHERE T1.BusinessEntityID = 13626
works_cycles
What's Lynn N Tsoflias's job title?
SELECT T2.JobTitle FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Lynn' AND T1.MiddleName = 'N' AND T1.LastName = 'Tsoflias'
works_cycles
What is the number of the sub categories for bikes?
Bike refers to the name of the product category, therefore ProductCategoryID = 1
SELECT COUNT(*) FROM ProductCategory AS T1 INNER JOIN ProductSubcategory AS T2 ON T1.ProductCategoryID = T2.ProductCategoryID WHERE T1.Name = 'Bikes'
works_cycles
For the document Control Assistant who was hired on 2009/1/22, what is the percentage of private documents did he/she have?
Document Control Assistant refers  to the  JobTitle = 'Document Control Assistant'; hired on 2009/1/22 means the person's hiring date is HireDate = '2009-01-22'; private documents indicate that DocumentSummary is null; DIVIDE(COUNT(DocumentSummary is null), COUNT(DocumentSummary))*100
SELECT CAST(SUM(CASE WHEN T1.DocumentSummary IS NOT NULL THEN 1 ELSE 0 END) AS REAL) / COUNT(T1.DocumentSummary) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.HireDate = '2009-01-22'
works_cycles
How much is HL Grip Tape's profit ratio?
HL Grip Tape refers to the product name; DIVIDE(SUBTRACT(LastReceiptCost, StandardPrice)), (StandardPrice) as profit_ratio
SELECT (T1.LastReceiptCost - T1.StandardPrice) / T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Grip Tape'
works_cycles
For all phone numbers, what percentage of the total is cell phone?
Cellphone referes to the name of the phone type, therefore PhoneNumberTypeID = 1; DIVIDE(COUNT(PhoneNumberTypeID = 1), (COUNT(PhoneNumberTypeID)) as percentage
SELECT CAST(SUM(CASE WHEN T2.Name = 'Cell' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Name) FROM PersonPhone AS T1 INNER JOIN PhoneNumberType AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID
works_cycles
What are the product assembly ID that come with unit measure code EA and BOM level of 2, at the same time have per assembly quantity of more than 10?
Per assembly quantity of more than 10 is expresses as PerAssemblyQty>10
SELECT ProductAssemblyID FROM BillOfMaterials WHERE UnitMeasureCode = 'EA' AND BOMLevel = 2 AND PerAssemblyQty > 10
works_cycles
How many location IDs have actual resource hours of 2?
actual resource hours of 2 refers to ActualResourceHrs = 2
SELECT COUNT(LocationID) FROM WorkOrderRouting WHERE ActualResourceHrs = 2
works_cycles
What is the stocked quantity of products manufactured from location ID 40?
Stocked quantity refers to StockedQty
SELECT COUNT(*) FROM WorkOrderRouting AS T1 INNER JOIN BillOfMaterials AS T2 ON T1.LocationID = T2.ProductAssemblyID INNER JOIN WorkOrder AS T3 ON T3.WorkOrderID = T1.WorkOrderID WHERE T1.LocationID = 40
works_cycles
What are the total per assembly quantity for unit measure code EA, IN and OZ respectively? What are the name of these 3 code?
Pre assembly quantity refers to PerAssemblyQty
SELECT SUM(T1.PerAssemblyQty), T2.Name FROM BillOfMaterials AS T1 INNER JOIN UnitMeasure AS T2 ON T1.UnitMeasureCode = T2.UnitMeasureCode WHERE T1.UnitMeasureCode IN ('EA', 'IN', 'OZ') GROUP BY T2.Name
works_cycles
Which product ID do not have any work order ID?
Do not have any work order ID means WorkOrderID is null
SELECT ProductID FROM Product WHERE ProductID NOT IN ( SELECT T1.ProductID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID )
works_cycles
What is the name of product purchased with transaction type P?
SELECT ProductID FROM Product WHERE ProductID IN ( SELECT ProductID FROM TransactionHistory WHERE TransactionType = 'P' )
works_cycles
State the full name of accountants in the company.
Accountants refers to JobTitle = 'Accountant'; full name includes FirstName, LastName, and MiddleName
SELECT T2.FirstName, T2.MiddleName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle = 'Accountant'
works_cycles
What is the job position currently occupied by Ken J Sánchez?
Job position refers to JobTitle
SELECT T1.JobTitle FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.FirstName = 'Ken' AND T2.MiddleName = 'J' AND T2.LastName = 'Sánchez'
works_cycles
How many male employees do not wish to receive e-mail promotion?
Male refers to Gender = 'M'; employees do not wish to receive any e-mail promotions are marked as EmailPromotion = 0
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 0 AND T1.Gender = 'M'
works_cycles
Who is the top sales person who achived highest percentage of projected sales quota in 2013?
2013 refers to QuotaDate = '2013'; DIVIDE(SalesLastYear), (SUM(SalesQuota where YEAR(QuotaDate) = 2013)) as percentage
SELECT BusinessEntityID FROM SalesPerson WHERE BusinessEntityID IN ( SELECT BusinessEntityID FROM SalesPersonQuotaHistory WHERE STRFTIME('%Y', QuotaDate) = '2013' ) ORDER BY CAST(SalesLastYear AS REAL) / SalesQuota DESC LIMIT 1
works_cycles
How many of the non-sales employees are married?
Married refers to MaritalStatus = 'M';  non-sales employees refer to PersonType = 'EM'
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'EM' AND T1.MaritalStatus = 'M'
works_cycles
Among the Production Technicians who are single, how many of them are vendor contact?
Production Technicians refer to the  JobTitle = 'Production Technician%'; single refers to MaritalStatus = 'S'; Vendor contact refers to PersonType = 'VC'
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' AND T1.MaritalStatus = 'S' AND T2.PersonType = 'VC'
works_cycles
What is the total sick leave hours of employees who do not wish to receive any e-mail promotion?
Employees who do not wish to receive any e-mail promotions are marked as EmailPromotion = 0
SELECT SUM(T1.SickLeaveHours) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 0
works_cycles
Among the sales people, who are hired prior to 2010?
Sales people refer to PersonType = 'SP'; hired prior to 2010 means the person's hiring date was before 2010, therefore year(HireDate)<2010
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP' AND SUBSTR(T1.HireDate, 0, 4) < 2010
works_cycles
Which sales person achieved the highest sales YTD? What is the projected yearly sales quota in 2011 for this person?
Sales people refer to PersonType = 'SP'; projected yearly sales refers to SalesQuota
SELECT T1.BusinessEntityID, SUM(T1.SalesQuota) FROM SalesPerson AS T1 INNER JOIN SalesPersonQuotaHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T2.QuotaDate) = '2011' GROUP BY T1.BusinessEntityID ORDER BY SUM(T1.SalesYTD) DESC LIMIT 1
works_cycles
How many people with the name Alex are single and occupying organization level of 1?
Alex refers to FirstName = 'Alex'; single refers to MaritalStatus = 'S'
SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.FirstName = 'Alex' AND T1.MaritalStatus = 'S' AND T1.OrganizationLevel = 1
works_cycles
What is the average vacation hours taken by Sales person?
Store Contact refers PersonType = 'SC'; AVG(VacationHours
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 T2.PersonType = 'SP'
works_cycles
State the last name and job title of owner for document "Crank Arm and Tire Maintenance".
The owner refers to BusinessEntityID
SELECT T1.LastName, T3.JobTitle FROM Person AS T1 INNER JOIN Document AS T2 ON T1.BusinessEntityID = T2.Owner INNER JOIN Employee AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T2.Title = 'Crank Arm and Tire Maintenance'
works_cycles
How many employees do not have any suffix and what are their organization level?
Do not have any suffix means Suffix is null
SELECT COUNT(T3.BusinessEntityID) FROM ( SELECT T1.BusinessEntityID FROM Employee AS T1 INNER JOIN Person AS T2 USING (BusinessEntityID) WHERE T2.Suffix IS NULL GROUP BY T1.BusinessEntityID ) AS T3
works_cycles
Among the sales people who achieved projected sales quota 2013, is there any person from territory ID 1? If yes, state the business entity ID.
projected sales quota refers to SalesQuota; projected sales quota in 2013 refers to year(QuotaDate) = 2013;
SELECT DISTINCT T1.BusinessEntityID FROM SalesPerson AS T1 INNER JOIN SalesPersonQuotaHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.TerritoryID = 1 AND STRFTIME('%Y', QuotaDate) = '2013'
works_cycles
Who are the employees that submitted resume to Human Resource Department and got hired? State the last name.
employees that submitted resume to Human Resource Department and got hired refers to BusinessEntittyID NOT null;
SELECT T3.LastName FROM Employee AS T1 INNER JOIN JobCandidate AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Person AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T1.BusinessEntityID IN (212, 274)