Chinastark/bird_dataset huggingface dataset:
Database: works_cycles
Question: Who is the top sales person who achived highest percentage of projected sales quota in 2013?
Evidence: 2013 refers to QuotaDate = '2013'; DIVIDE(SalesLastYear), (SUM(SalesQuota where YEAR(QuotaDate) = 2013)) as percentage

SQL: 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
Database: works_cycles
Question: How many of the non-sales employees are married?
Evidence: Married refers to MaritalStatus = 'M';  non-sales employees refer to PersonType = 'EM'
SQL: 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'
Database: works_cycles
Question: Among the Production Technicians who are single, how many of them are vendor contact?
Evidence: Production Technicians refer to the  JobTitle = 'Production Technician%'; single refers to MaritalStatus = 'S'; Vendor contact refers to PersonType = 'VC'
SQL: 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'
Database: works_cycles
Question: What is the total sick leave hours of employees who do not wish to receive any e-mail promotion?
Evidence: Employees who do not wish to receive any e-mail promotions are marked as EmailPromotion = 0
SQL: SELECT SUM(T1.SickLeaveHours) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 0
Database: works_cycles
Question: Among the sales people, who are hired prior to 2010?
Evidence: Sales people refer to PersonType = 'SP'; hired prior to 2010 means the person's hiring date was before 2010, therefore year(HireDate)<2010
SQL: 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
Database: works_cycles
Question: Which sales person achieved the highest sales YTD? What is the projected yearly sales quota in 2011 for this person?
Evidence: Sales people refer to PersonType = 'SP'; projected yearly sales refers to SalesQuota
SQL: 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
Database: works_cycles
Question: How many people with the name Alex are single and occupying organization level of 1?
Evidence: Alex refers to FirstName = 'Alex'; single refers to MaritalStatus = 'S'
SQL: 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
Database: works_cycles
Question: What is the average vacation hours taken by Sales person?
Evidence: Store Contact refers PersonType = 'SC'; AVG(VacationHours
SQL: SELECT CAST(SUM(T1.VacationHours) AS REAL) / COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP'
Database: works_cycles
Question: State the last name and job title of owner for document "Crank Arm and Tire Maintenance".
Evidence: The owner refers to BusinessEntityID
SQL: 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'
Database: works_cycles
Question: How many employees do not have any suffix and what are their organization level?
Evidence: Do not have any suffix means Suffix is null
SQL: 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
Database: works_cycles
Question: 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.
Evidence: projected sales quota refers to SalesQuota; projected sales quota in 2013 refers to year(QuotaDate) = 2013;
SQL: 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'
Database: works_cycles
Question: Who are the employees that submitted resume to Human Resource Department and got hired? State the last name.
Evidence: employees that submitted resume to Human Resource Department and got hired refers to BusinessEntittyID NOT null;
SQL: 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)
Database: works_cycles
Question: List down the email address of female single employees.
Evidence: female refers to Gender = 'F'; single refers to MaritalStatus = 'S';
SQL: SELECT T3.EmailAddress FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmailAddress AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.Gender = 'F' AND T1.MaritalStatus = 'S'
Database: works_cycles
Question: What are the color of products that were reviewed?
SQL: SELECT T1.Color FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 709 OR 937 OR 798
Database: works_cycles
Question: What is the projected sales quota amount in 2013 and sales YTD amount for sales person with business entity ID 275?
Evidence: projected sales quota refers to SalesQuota; projected sales quota in 2013 refers to year(QuotaDate) = 2013; projected sales quota for 2013 = SUM(SalesQuota where year(QuotaDate) = 2013);
SQL: SELECT SUM(T1.SalesQuota) FROM SalesPerson AS T1 INNER JOIN SalesPersonQuotaHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.BusinessEntityID = 275 AND STRFTIME('%Y', QuotaDate) = '2013'
Database: works_cycles
Question: Provide the business entity ID who did not achieved projected yearly sales quota in 2013.
Evidence: projected yearly sales quota refers to SalesQuota; sales quota in 2013 refers to year(QuotaDate) = 2013; person who did not achieve projected yearly sales quota refers to SalesQuota>SalesYTD;
SQL: SELECT DISTINCT T1.BusinessEntityID FROM SalesPerson AS T1 INNER JOIN SalesPersonQuotaHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T2.QuotaDate) = '2013' AND T1.SalesQuota < T1.SalesLastYear
Database: works_cycles
Question: Among the employees who wish to receive e-mail promotion from AdventureWorks, how many percent of them are female?
Evidence: female refers to Gender = 'F'; employee who wish to receive email promotion refers to EmailPromotion = 1; percentage = DIVIDE(SUM(Gender = 'F')), (sum(Gender = 'F' or Gender = 'M'))) as percentage;
SQL: SELECT CAST(SUM(CASE WHEN T1.Gender = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 1
Database: works_cycles
Question: How many times is married non sales employees against single non-sales employees?
Evidence: non-sales employee refers to PersonType = 'EM'; married refers to MaritalStatus = 'M'; single refers to MaritalStatus = 'S'; percentage = DIVIDE(SUM(MaritalStatus = 'M'), (SUM(MaritalStatus = 'S') as percentage;
SQL: SELECT CAST(SUM(CASE WHEN T1.MaritalStatus = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T1.MaritalStatus = 'S' THEN 1 ELSE 0 END) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'EM'
Database: works_cycles
Question: How much is the total bonus received by sales person and what is the percentage of it against the projected yearly sales quota in 2013?
Evidence: projected yearly sales quota refers to SalesQuota; projected yearly sales quota in 2013 refers to year(QuotaDate) = 2013; percentage = (MULTIPLY(DIVIDE(SUM(Bonus)), (SUM(SalesQuota))) as percentage;
SQL: SELECT SUM(T1.Bonus) , CAST(SUM(T1.Bonus) AS REAL) * 100 / SUM(T1.SalesQuota) FROM SalesPerson AS T1 INNER JOIN SalesPersonQuotaHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T2.QuotaDate) = '2013'
Database: works_cycles
Question: How many types of credit cards are there and how many are vista?
Evidence: type of credit card refers to CardType; CardType = 'Vista';
SQL: SELECT COUNT(CardNumber) FROM CreditCard WHERE CardType = 'vista'
Database: works_cycles
Question: What is the name of the product with the id "475"?
SQL: SELECT Name FROM Product WHERE ProductID = 475
Database: works_cycles
Question: Among the employees born before 1980 , how many of them are single?
Evidence: BirthDate<'1980-01-01'; single refers to MaritalStatus = 'S' or null;
SQL: SELECT COUNT(BusinessEntityID) FROM Employee WHERE MaritalStatus = 's' AND BirthDate < '1980-1-1'
Database: works_cycles
Question: List all the names of the stores assigned to the sales person with the id "277".
SQL: SELECT Name FROM Store WHERE SalesPersonID = 277
Database: works_cycles
Question: How many products with the id "989" were sold in August 2013?
Evidence: TransactionDate BETWEEN '2013-08-01' AND '2013-08-30'; sold in refers to TransactionType = 'S' which means SalesOrder;
SQL: SELECT SUM(Quantity) FROM TransactionHistory WHERE TransactionDate LIKE '2013-08%' AND TransactionType = 'S' AND ProductID = 989
Database: works_cycles
Question: List all of the credit cards that had expired by 2007.
Evidence: card that expires in 2007 refers to ExpYear = 2007;
SQL: SELECT CardNumber FROM CreditCard WHERE ExpYear < 2007
Database: works_cycles
Question: List all the pay rates of all employees that were hired at 20 years of age.
Evidence: pay rate refers to Rate; 20 years old at the time of being hired refers to SUBTRACT(year(HireDate)), (year(BirthDate))) = 20;
SQL: SELECT T2.Rate FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T1.HireDate) - STRFTIME('%Y', T1.BirthDate) = 20
Database: works_cycles
Question: What is the name of the territory assigned to the sales person with business id "277"?
Evidence: business id refers to BusinessEntityID
SQL: SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277
Database: works_cycles
Question: What is the full name of the Vice President of Production?
Evidence: full name = FirstName+MiddleName+LastName; Vice President of Production is a JobTitle;
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 = 'Vice President of Production'
Database: works_cycles
Question: How many employees in the Information Service department work the evening shift?
Evidence: Information Service is a name of department;
SQL: SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID INNER JOIN Shift AS T3 ON T2.ShiftId = T3.ShiftId WHERE T1.Name = 'Information Services' AND T3.Name = 'Evening'
Database: works_cycles
Question: List all the purchase order ids of the vendor with a below average rating.
Evidence: below average rating refers to CreditRating = 5;
SQL: SELECT T2.PurchaseOrderID FROM Vendor AS T1 INNER JOIN PurchaseOrderHeader AS T2 ON T1.BusinessEntityID = T2.VendorID WHERE T1.CreditRating = 5
Database: works_cycles
Question: Is the phone number "114-555-0100" a work number or a home number?
SQL: SELECT T2.Name FROM PersonPhone AS T1 INNER JOIN PhoneNumberType AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID WHERE T1.PhoneNumber = '114-555-0100'
Database: works_cycles
Question: What is the total shipment by "cargo transport 5" cost of all purchase orders created on 12/14/2011?
Evidence: Catgo Transport 5 is a name of shipping method; OrderDate = '2011-12-14'; total shipment cost = SUM(Freight);
SQL: SELECT SUM(t2.freight) FROM ShipMethod AS t1 INNER JOIN PurchaseOrderHeader AS t2 ON t1.shipmethodid = t2.shipmethodid WHERE t1.name = 'cargo transport 5' AND t2.orderdate = '2011-12-14'
Database: works_cycles
Question: How many sales orders did the salesperson David R. Campbell create?
Evidence: SP is an abbreviation for Sales Person; PersonType = 'SP';
SQL: SELECT COUNT(T2.TotalDue) FROM Person AS T1 INNER JOIN SalesOrderHeader AS T2 ON T1.ModifiedDate = T2.DueDate WHERE T1.FirstName = 'David' AND T1.MiddleName = 'R' AND T1.LastName = 'Campbell' AND T1.PersonType = 'SP'
Database: works_cycles
Question: What is the email address of the Facilities Manager?
Evidence: Facilities Manager is a job title
SQL: SELECT T3.EmailAddress FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmailAddress AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.JobTitle = 'Facilities Manager'
Database: works_cycles
Question: How many customers are there in Canada?
Evidence: Canada is name of sales territory
SQL: SELECT COUNT(T2.CustomerID) FROM SalesTerritory AS T1 INNER JOIN Customer AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.Name = 'Canada'
Database: works_cycles
Question: What is the shipping address for the sales order "43873"?
Evidence: shipping address = AddressLine1+AddressLine2+City;
SQL: SELECT T1.ShipToAddressID FROM SalesOrderHeader AS T1 INNER JOIN Address AS T2 ON T1.BillToAddressID = T2.AddressID WHERE T1.SalesOrderID = 43873 GROUP BY T1.ShipToAddressID
Database: works_cycles
Question: List the first names of the people with more than 65 sick leave hours.
Evidence: SickLeaveHours>65;
SQL: SELECT T2.FirstName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.SickLeaveHours > 65
Database: works_cycles
Question: Among all the production technicians, how many have a below average pay rate for a production technician?
Evidence: production technician is a job title; below average rate refers to Rate<AVG(Rate);
SQL: SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' AND T2.Rate < ( SELECT AVG(T2.Rate) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' )
Database: works_cycles
Question: What proportion of sales orders are made from the United Kingdom?
Evidence: proportion = DIVIDE(SUM(Name = 'UK')), (COUNT(SalesOrderID))) as count;
SQL: SELECT CAST(SUM(CASE WHEN T2.Name = 'United Kingdom' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.SalesOrderID) FROM SalesOrderHeader AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID
Database: works_cycles
Question: When is the modified date of the phone number "1500 555-0143"?
SQL: SELECT ModifiedDate FROM PersonPhone WHERE PhoneNumber = '1 (11) 500 555-0143'
Database: works_cycles
Question: What is the business ID of the person who has made the most sales total year to date?
Evidence: business ID refers to BusinessEntityID; sales total year to date refers to SalesYTD; most sales total year to date refers to MAX(SalesYTD);
SQL: SELECT BusinessEntityID FROM SalesPerson ORDER BY SalesYTD DESC LIMIT 1
Database: works_cycles
Question: List all active vendors who offer a purchasing web service.
Evidence: active vendors refers to ActiveFlag = 1; vendor who offer a purchasing web service refers to PurchasingWebServiceURL NOT null;
SQL: SELECT Name FROM Vendor WHERE ActiveFlag = 1
Database: works_cycles
Question: Which territory has the most customers as of 9/12/2014?
Evidence: ModifiedDate between'2014-09-12 00:00:00' and '2014-09-12 23:59:59';
SQL: SELECT TerritoryID FROM Customer WHERE ModifiedDate < '2014-12-09' GROUP BY TerritoryID ORDER BY COUNT(TerritoryID) DESC LIMIT 1
Database: works_cycles
Question: What is the total cost for all the orders placed on 5/29/2013?
Evidence: total cost = SUM(TotalDue); OrderDate = '2013-05-29';
SQL: SELECT SUM(TotalDue) FROM PurchaseOrderHeader WHERE OrderDate LIKE '2013-05-29%'
Database: works_cycles
Question: What is the most common first name among the vendor contact?
Evidence: vendor contact refers to PersonType = 'VC';
SQL: SELECT FirstName FROM Person WHERE PersonType = 'VC' GROUP BY FirstName ORDER BY COUNT(*) DESC LIMIT 1
Database: works_cycles
Question: List the full name of all the 'Production Technician - WC50'
Evidence: full name = FirstName+MiddleName+LastName; Production Technician - WC50 is a job title;
SQL: SELECT T2.FirstName, T2.MiddleName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 USING (BusinessEntityID) WHERE T1.JobTitle = 'Production Technician - WC50' GROUP BY T2.FirstName, T2.MiddleName, T2.LastName
Database: works_cycles
Question: How many Minipumps have been sold?
Evidence: Minipump is name of a product
SQL: SELECT COUNT(OrderQty) FROM SalesOrderDetail WHERE ProductID IN ( SELECT ProductID FROM Product WHERE Name = 'Minipump' )
Database: works_cycles
Question: What is the person's business ID with a vista credit card number "11113366963373"?
Evidence: business id refers to BusinessEntityID
SQL: SELECT T2.BusinessEntityID FROM CreditCard AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID WHERE T1.CardNumber = 11113366963373
Database: works_cycles
Question: Where does the person with the BusinessEntityID "5555" live?
Evidence: where the person live refers addresstype.Name = 'Home'
SQL: SELECT T3.City, T3.AddressLine1 FROM BusinessEntityAddress AS T1 INNER JOIN AddressType AS T2 ON T1.AddressTypeID = T2.AddressTypeID INNER JOIN Address AS T3 ON T1.AddressID = T3.AddressID WHERE T1.BusinessEntityID = 5555 AND T2.Name = 'Home'
Database: works_cycles
Question: List all the names of products with the special offer "15".
SQL: SELECT T2.Name FROM SpecialOfferProduct AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.SpecialOfferID = 15
Database: works_cycles
Question: What is the credit card number for Michelle E Cox?
Evidence: credit card number refers to CreditCardID
SQL: SELECT T3.CreditCardID FROM Person AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN CreditCard AS T3 ON T2.CreditCardID = T3.CreditCardID WHERE T1.FirstName = 'Michelle' AND T1.MiddleName = 'E' AND T1.LastName = 'Cox'
Database: works_cycles
Question: What is the reason for sales order "51883"?
Evidence: reason means the category of sales reason which refers to ReasonType
SQL: SELECT T2.Name FROM SalesOrderHeaderSalesReason AS T1 INNER JOIN SalesReason AS T2 ON T1.SalesReasonID = T2.SalesReasonID WHERE T1.SalesOrderID = 51883
Database: works_cycles
Question: What is the credit card number for the sales order "45793"?
SQL: SELECT T2.CardNumber FROM SalesOrderHeader AS T1 INNER JOIN CreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID WHERE T1.SalesOrderID = 45793
Database: works_cycles
Question: List all the sales people in the Northwest US.
Evidence: Northwest is name of SalesTerritory; US is the CountryRegionCode;
SQL: SELECT T2.BusinessEntityID FROM SalesTerritory AS T1 INNER JOIN SalesPerson AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.Name = 'Northwest' AND T1.CountryRegionCode = 'US'
Database: works_cycles
Question: Which Production Technician has the highest pay rate?
Evidence: highest pay rate refers to MAX(Rate);
SQL: SELECT T1.BusinessEntityID FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' ORDER BY T2.Rate DESC LIMIT 1
Database: works_cycles
Question: Who is the sales person in charge of the territory with the id "9"? Provide their full name.
Evidence: full name = FirstName+MiddleName+LastName;
SQL: SELECT T2.FirstName, T2.MiddleName, T2.LastName FROM SalesPerson AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.TerritoryID = 9
Database: works_cycles
Question: What is the description of the discount for the product with the id "762"?
SQL: SELECT T2.Description FROM SpecialOfferProduct AS T1 INNER JOIN SpecialOffer AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID WHERE T1.ProductID = 762
Database: works_cycles
Question: Compare the average pay rate of male and female employees.
Evidence: male refers to Gender = 'M'; female refers to Gender = 'F'; difference in average rate = DIVIDE(AVG(Rate where Gender = 'F')), (AVG(Rate where Gender = 'M'))) as diff;
SQL: SELECT AVG(T2.Rate) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID GROUP BY T1.Gender
Database: works_cycles
Question: What is the percentage of employees who work the night shift?
Evidence: percentage = DIVIDE(SUM(Name = 'Night')), (COUNT(ShiftID)) as percentage;
SQL: SELECT CAST(SUM(CASE WHEN T1.Name = 'Night' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.BusinessEntityID) FROM Shift AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.ShiftId = T2.ShiftId
Database: works_cycles
Question: How many married male employees were born before the year 1960?
Evidence: married refers to MaritalStatus = 'M'; male refers to Gender = 'M'; BirthDate < = '1959-12-31';
SQL: SELECT COUNT(BusinessEntityID) FROM Employee WHERE MaritalStatus = 'M' AND STRFTIME('%Y', BirthDate) < '1960' AND Gender = 'M'
Database: works_cycles
Question: What are the top 5 types of products with the highest selling price? ?
Evidence: highest selling price refers to MAX(ListPrice);
SQL: SELECT Name FROM Product ORDER BY ListPrice DESC LIMIT 5
Database: works_cycles
Question: When did the company hired its first Accountant?
Evidence: Accountant is a job title; first hired = MIN(HireDate)
SQL: SELECT MIN(HireDate) FROM Employee WHERE JobTitle = 'Accountant'
Database: works_cycles
Question: In 2007, which job position was hired the most?
Evidence: Job position and job title are synonyms; job position that was hired the most refers to MAX(COUNT(JobTitle); HireDate BETWEEN '2007-1-1' AND '2007-12-31';
SQL: SELECT JobTitle FROM Employee WHERE STRFTIME('%Y', HireDate) = '2007' GROUP BY HireDate ORDER BY COUNT(JobTitle) DESC LIMIT 1
Database: works_cycles
Question: What is the profit on net of the vendor with the highest standard price? If there are two vendors of the same amount, calculate only for one vendor.
Evidence: profit on net = SUBTRACT(LastReceiptCost, StandardPrice);
SQL: SELECT LastReceiptCost - StandardPrice FROM ProductVendor ORDER BY StandardPrice DESC LIMIT 1
Database: works_cycles
Question: How many departments did Sheela Ward work in between 1/1/2011 to 12/31/2012
Evidence: number of departments an employee works for between 2011 and 2012 refers to year(StartDate) BETWEEN 2011 AND 2012 and year(EndDate) BETWEEN 2011 and 2012;
SQL: SELECT COUNT(T3.Name) FROM Person AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Department AS T3 ON T2.DepartmentID = T3.DepartmentID WHERE T1.FirstName = 'Sheela' AND T1.LastName = 'Word' AND STRFTIME('%Y', T3.ModifiedDate) BETWEEN '2011' AND '2012'
Database: works_cycles
Question: What is the average age of the sales agents in the company by 12/31/2009?
Evidence: average age as of 12/31/2009 = AVG(SUBTRACT(2009, year(BirthDate));
SQL: SELECT AVG(2009 - STRFTIME('%Y', T2.BirthDate)) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SP'