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