Chinastark/bird_dataset huggingface dataset:
Database: works_cycles
Question: What are the company that Adventure Works deal with that have poor credit rating? Please provide their business number.
Evidence: poor credit rating means bad credit; CreditRating = 5; Business number refers to BusinessEntityID
SQL: SELECT BusinessEntityID FROM Vendor WHERE CreditRating = ( SELECT CreditRating FROM Vendor ORDER BY CreditRating DESC LIMIT 1 )
Database: works_cycles
Question: What is the forename and birthdate of person number 18?
Evidence: person number 18 refers to BusinessEntityID = 18; forename refers to FirstName
SQL: SELECT T1.FirstName, T2.BirthDate FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.BusinessEntityID = 18
Database: works_cycles
Question: What job is person number 322 currently holding?
Evidence: person number 322 refers to PersonID = 18; job is the name of contacttype
SQL: SELECT T1.Name FROM ContactType AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.ContactTypeID = T2.ContactTypeID WHERE T2.BusinessEntityID = 332
Database: works_cycles
Question: Please list 3 businesses along with their IDs that use cellphones.
Evidence: business along with their IDs = BusinessEntityID; Cellphones refers to PhoneNumberType.name = ‘cell’
SQL: SELECT T2.BusinessEntityID FROM PhoneNumberType AS T1 INNER JOIN PersonPhone AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID WHERE T1.Name = 'Cell' LIMIT 3
Database: works_cycles
Question: What is the currency of Brazil?
SQL: 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'
Database: works_cycles
Question: How many people work in the finance department?
SQL: SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID WHERE T1.Name = 'Finance'
Database: works_cycles
Question: How long does it take for the business to receive the item it has purchased? Who is the vendor for business number 1496?
Evidence: business number refers to BusinessEntityID where BusinessEntityID = 1496; how long does it take refers to AverageLeadTime
SQL: 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
Database: works_cycles
Question: How many accounts are in Bothell as opposed to Kenmore? What is the name of the State that comprises these two cities?
Evidence: SUBTRACT(count(city = 'Bothell'), count(city = 'Kenmore'))
SQL: 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
Database: works_cycles
Question: Which chromoly steel product model has AdventureWorks saved in English?
Evidence: Saved in English refers to product description written in English where Culture.name = 'English'
SQL: 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'
Database: works_cycles
Question: Please list the total number of companies with a commission percentage of 0.018 or above, along with each company's assigned geographical location.
Evidence: geographical location refers to group from SalesPerson; ComissionPct refers to commission percentage where ComissionPct > = 0.018;
SQL: SELECT T1.BusinessEntityID, T2.'Group' FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 USING (territoryid) WHERE T1.CommissionPct >= 0.018
Database: works_cycles
Question: Please list the various phone number types in the following order, from most to least common among businesses.
SQL: 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
Database: works_cycles
Question: Which role has the most common contact among businesses?
Evidence: Most common contact among businesses refers to BusinessEntityContact with the most name
SQL: 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
Database: works_cycles
Question: What are the salespeople's email addresses?
Evidence: Salespeople refers to PersonType = 'SP'
SQL: SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SP'
Database: works_cycles
Question: Which position does Suchitra hold?
Evidence: position refers to JobTitle
SQL: SELECT T2.JobTitle FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Suchitra'
Database: works_cycles
Question: How many employees work for AdvertureWorks that is single?
Evidence: Employees refer to PersonType = 'EM'; Single refers to MaritalStatus = 's'
SQL: 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'
Database: works_cycles
Question: How much do the works data saved in English and Arabic differ from one another?
Evidence: 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'))
SQL: 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'
Database: works_cycles
Question: What is the location of business number 1?
Evidence: Location refers to AddressLine1; business number refers to the BusinessEntityID where BusinessEntityID = 1
SQL: SELECT T1.AddressLine1 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 USING (AddressID) WHERE T2.BusinessEntityID = 1
Database: works_cycles
Question: Please list the businesses along with their numbers that have their accounts located in Duvall.
Evidence: Business along with their numbers refers to the BusinessEntityID; located in Duvall refers to City = 'Duvall'
SQL: SELECT T2.BusinessEntityID FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T1.City = 'Duvall'
Database: works_cycles
Question: What percentage of the AdventureWorks data is in Thai?
Evidence: percentage = DIVIDE(Culture.Name = 'Thai', count(ALL Culture.Name))*100%
SQL: 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
Database: works_cycles
Question: What percentage of AdventureWorks employees are men?
Evidence: male refers to Gender = 'M'; employee refers to PersonType = 'EM'; percentage = DIVIDE(COUNT(Gender = 'M'), COUNT(PersonType = 'MY'))*100%;
SQL: 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'
Database: works_cycles
Question: Where is the address 15873 located, in what city and state? Does that city belong to a province where the code exists?
Evidence: Address number 15873 refers to AddressID = '15873'; IsOnlyStateProvinceCode = '0' refers to StateProvinceCode exists; IsOnlyStateProvinceCode = '1' refers to StateProvinceCode unavailable;
SQL: 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
Database: works_cycles
Question: What is the full address of business number 24?
Evidence: Full address refers to AddressLine1+AddressLine2; business number 24 refers to BusinessEntityID = '24'
SQL: SELECT T1.AddressLine1, T1.AddressLine2 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T2.BusinessEntityID = 24
Database: works_cycles
Question: Which year is credit card No.9648's Expiration Year?
Evidence: Expiration year refers to ExpYear
SQL: SELECT ExpYear FROM CreditCard WHERE CreditCardID = 9648
Database: works_cycles
Question: What's Emma H Harris's Business Entity ID number?
SQL: SELECT BusinessEntityID FROM Person WHERE FirstName = 'Emma' AND LastName = 'Harris'
Database: works_cycles
Question: What is the location id for Debur and Polish?
Evidence: Debur and Polish is name of manufacturing location
SQL: SELECT LocationID FROM Location WHERE Name = 'Debur and Polish'
Database: works_cycles
Question: What are the Department ids under the Sales and Marketing Group?
Evidence: Sales and Marketing is group name of a department
SQL: SELECT DepartmentID FROM Department WHERE GroupName = 'Sales and Marketing'
Database: works_cycles
Question: Which sales person made the sale of 1635823.3967 last year? Give the Business Entity ID.
SQL: SELECT BusinessEntityID FROM SalesPerson WHERE SalesLastYear = '1635823.3967'
Database: works_cycles
Question: What is the Shift start time for Shift ID No.2?
SQL: SELECT StartTime FROM Shift WHERE ShiftID = '2'
Database: works_cycles
Question: What is contact Type ID No.16 represent for?
SQL: SELECT Name FROM ContactType WHERE ContactTypeID = '16'
Database: works_cycles
Question: What is the minimum shipping charge for "OVERSEAS - DELUXE"?
Evidence: Minimum shipping charge refers to ShipBase; OVERSEAS - DELUXE is name of shipping company
SQL: SELECT ShipBase FROM ShipMethod WHERE Name = 'OVERSEAS - DELUXE'
Database: works_cycles
Question: Please tell the meaning of CultureID "fr".
Evidence: tell the meaning is to find the name of culture
SQL: SELECT Name FROM Culture WHERE CultureID = 'fr'
Database: works_cycles
Question: Give the Mauritius Rupee's currency code.
Evidence: Mauritius Rupee is name of currency
SQL: SELECT CurrencyCode FROM Currency WHERE Name = 'Mauritius Rupee'
Database: works_cycles
Question: Name cellphone number's Type ID?
Evidence: Cellphone refers to Name = 'Cell'
SQL: SELECT PhoneNumberTypeID FROM PhoneNumberType WHERE Name = 'Cell'
Database: works_cycles
Question: For the older production technician who was hired in 2008/12/7, what's his/her birthday?
Evidence: Oldest production technician refers to MIN(BirthDate) where JobTitle = 'Production Technician'
SQL: SELECT BirthDate FROM Employee WHERE HireDate = '2008-12-07'
Database: works_cycles
Question: What is the product ID No.793's model name?
SQL: SELECT T1.Name FROM Product AS T1 INNER JOIN ProductModel AS T2 ON T1.ProductModelID = T2.ProductModelID WHERE T1.ProductID = 793
Database: works_cycles
Question: What are the unit measure codes for product ID No.762?
SQL: 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
Database: works_cycles
Question: Where is Business Entity ID No.4 located at? Give the address down to street.
Evidence: Located refers to the total address of the entity that comprises city, addressline1, addressline2
SQL: SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID IN ( SELECT AddressID FROM BusinessEntityAddress WHERE BusinessEntityID = 4 )
Database: works_cycles
Question: For the on going assembly item Component ID No. 494, what's the Unit measure for it?
Evidence: On going assembly item means the assembly item haven't been finished, therefore EndDate is null
SQL: 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
Database: works_cycles
Question: For the document Control Assistant who was born on 1975/12/25, how many private documents did he/she have?
Evidence: 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
SQL: 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
Database: works_cycles
Question: To the products which could make the profit as 21.9037, what were their list price after October of 2012?
Evidence: Profit as 82.41 = SUTRACT(ListPrice, StandardCost); May of 2012 refers to StartDate = '2012-05'
SQL: 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'
Database: works_cycles
Question: What is the size of the photo of product id No.1?
SQL: SELECT T1.ThumbNailPhoto FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T2.ProductID = 1
Database: works_cycles
Question: How many letters are there in Catherine Ward's e-mail account passwords?
Evidence: Catherine Ward refers to the name of BusinessEntityID; how many letters in password for the e-mail account refers to LENGTH(PasswordHash)
SQL: 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'
Database: works_cycles
Question: What rating did Jill give for HL Mountain Pedal?
Evidence: Jill refers to the name of reviewer; HL Mountain Pedal refers to the name of the product
SQL: 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'
Database: works_cycles
Question: What's the profit for the Freewheel?
Evidence: SUBTRACT(LastReceiptCost, StandardPrice) for ProductID where name = 'Freewheel'
SQL: SELECT T1.LastReceiptCost - T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Freewheel'
Database: works_cycles
Question: Did Rachel Valdez complete her sales task?
Evidence: Complete sales task refers to meeting sales quota; if Bonus = 0, it means this salesperson doesn't meet quota and vice versa
SQL: 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'
Database: works_cycles
Question: How many types of tax did the sales happen in Quebec have?
Evidence: 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
SQL: SELECT COUNT(DISTINCT T1.Name) FROM SalesTaxRate AS T1 INNER JOIN StateProvince AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.Name = 'Quebec'
Database: works_cycles
Question: What's Kevin A Wright's email address?
SQL: 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'
Database: works_cycles
Question: What is the number of State Province of France that doesn't have a State Province Code?
Evidence: Doesn't have a State Province Code refers to IsOnlyStateProvinceFlag = 1 where StateProvinceCode is unavailable
SQL: 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
Database: works_cycles
Question: What kind of transaction type for the "HL Road Frame - Black, 48" order happened in 2012/12/13?
Evidence: Transactiontype = 'w' means 'WorkOrder'; transactiontype = 's' means 'SalesOrder'; transactiontype = 'P' means 'PurchaseOrder'; happened in refers to TransactionDate
SQL: 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'
Database: works_cycles
Question: Which type of transaction was it for the "LL Road Handlebars" order happened in 2012/11/3?
Evidence: Transactiontype = 'w' means 'WorkOrder'; transactiontype = 's' means 'SalesOrder'; transactiontype = 'P' means 'PurchaseOrder'; happened in refers to TransactionDate
SQL: 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'
Database: works_cycles
Question: How is the Credit Rating for company whose rowguid is "33671A4E-DF2B-4879-807B-E3F930DD5C0C"?
Evidence: CreditRating = 1 means 'Superior'; CreditRating = 2 means 'Excellent'; CreditRating = 3 means 'Above average'; CreditRating = 4 means 'Superior'; CreditRating = 5 means 'Below average'
SQL: 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'
Database: works_cycles
Question: What is the PreferredVendorStatus for the company which has the rowguid of "684F328D-C185-43B9-AF9A-37ACC680D2AF"?
Evidence: PreferredVendorStatus = 1 means 'Do not use if another vendor is available'; CreditRating = 2 means 'Preferred over other vendors supplying the same product'
SQL: 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'
Database: works_cycles
Question: For person id No.2054, is his/her vendor still active?
Evidence: ActiveFlag = 1 means 'Vendor no longer used'; ActiveFlag = 2 means 'Vendor is actively used
SQL: SELECT T1.ActiveFlag FROM Vendor AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonID = 2054
Database: works_cycles
Question: Show me the phone number of Gerald Patel's.
SQL: 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'
Database: works_cycles
Question: Which is Business Entity ID No.13626's phone number type?
SQL: SELECT T2.Name FROM PersonPhone AS T1 INNER JOIN PhoneNumberType AS T2 USING (PhoneNumberTypeID) WHERE T1.BusinessEntityID = 13626
Database: works_cycles
Question: What's Lynn N Tsoflias's job title?
SQL: 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'
Database: works_cycles
Question: What is the number of the sub categories for bikes?
Evidence: Bike refers to the name of the product category, therefore ProductCategoryID = 1
SQL: SELECT COUNT(*) FROM ProductCategory AS T1 INNER JOIN ProductSubcategory AS T2 ON T1.ProductCategoryID = T2.ProductCategoryID WHERE T1.Name = 'Bikes'
Database: works_cycles
Question: For the document Control Assistant who was hired on 2009/1/22, what is the percentage of private documents did he/she have?
Evidence: 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
SQL: 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'
Database: works_cycles
Question: How much is HL Grip Tape's profit ratio?
Evidence: HL Grip Tape refers to the product name; DIVIDE(SUBTRACT(LastReceiptCost, StandardPrice)), (StandardPrice) as profit_ratio
SQL: 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'
Database: works_cycles
Question: For all phone numbers, what percentage of the total is cell phone?
Evidence: Cellphone referes to the name of the phone type, therefore PhoneNumberTypeID = 1; DIVIDE(COUNT(PhoneNumberTypeID = 1), (COUNT(PhoneNumberTypeID)) as percentage
SQL: 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
Database: works_cycles
Question: 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?
Evidence: Per assembly quantity of more than 10 is expresses as PerAssemblyQty>10
SQL: SELECT ProductAssemblyID FROM BillOfMaterials WHERE UnitMeasureCode = 'EA' AND BOMLevel = 2 AND PerAssemblyQty > 10
Database: works_cycles
Question: How many location IDs have actual resource hours of 2?
Evidence: actual resource hours of 2 refers to ActualResourceHrs = 2
SQL: SELECT COUNT(LocationID) FROM WorkOrderRouting WHERE ActualResourceHrs = 2
Database: works_cycles
Question: What is the stocked quantity of products manufactured from location ID 40?
Evidence: Stocked quantity refers to StockedQty
SQL: 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
Database: works_cycles
Question: What are the total per assembly quantity for unit measure code EA, IN and OZ respectively? What are the name of these 3 code?
Evidence: Pre assembly quantity refers to PerAssemblyQty
SQL: 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
Database: works_cycles
Question: Which product ID do not have any work order ID?
Evidence: Do not have any work order ID means WorkOrderID is null
SQL: 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 )
Database: works_cycles
Question: What is the name of product purchased with transaction type P?
SQL: SELECT ProductID FROM Product WHERE ProductID IN ( SELECT ProductID FROM TransactionHistory WHERE TransactionType = 'P' )
Database: works_cycles
Question: State the full name of accountants in the company.
Evidence: Accountants refers to JobTitle = 'Accountant'; full name includes FirstName, LastName, and MiddleName
SQL: 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'
Database: works_cycles
Question: What is the job position currently occupied by Ken J SÃ¡nchez?
Evidence: Job position refers to JobTitle
SQL: 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'
Database: works_cycles
Question: How many male employees do not wish to receive e-mail promotion?
Evidence: Male refers to Gender = 'M'; employees do not wish to receive any e-mail promotions are marked as EmailPromotion = 0
SQL: 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'