Chinastark/bird_dataset huggingface dataset:
Database: works_cycles
Question: Among the employees who were born before 1969, what is the work shift of the 6th oldest employee?
Evidence: oldest employee born before 1969 refers to year(BirthDate)<'1969';
SQL: SELECT T3.StartTime, T3.EndTime FROM Employee AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Shift AS T3 ON T2.ShiftId = T3.ShiftId WHERE STRFTIME('%Y', T1.BirthDate) < '1969' ORDER BY T1.BirthDate LIMIT 5, 1
Database: works_cycles
Question: Which product allows the company to make the highest profit on a single item among those that are the fastest to manufacture? Indicate the rating of the product if there any.
Evidence: profit on a single item = SUBTRACT(ListPrice, StandardCost); length of time to manufacture refers to DaysToManufacture; fastest to manucature refers to MIN(DaysToManufacture);
SQL: SELECT T1.Name, T2.Rating FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T1.DaysToManufacture = ( SELECT DaysToManufacture FROM Product ORDER BY DaysToManufacture LIMIT 1 ) ORDER BY T1.ListPrice - T1.StandardCost DESC LIMIT 1
Database: works_cycles
Question: What are the full names of the sales person whose bonuses are less than 1,000?
Evidence: full name = FirstName+MiddleName+LastName; Bonus<1000;
SQL: SELECT T2.FirstName, T2.MiddleName, T2.LastName FROM SalesPerson AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Bonus < 1000
Database: works_cycles
Question: When did the Senior Tool Designer, who was 33 years old at the time he was hired, stopped working in the Engineering department?
Evidence: Senior Tool Designer is a JobTitle; 33 years old at the time of hiring refers to SUBTRACT(year(HireDate)), (year(BirthDate)) = 33;
SQL: SELECT T2.EndDate FROM Employee AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Department AS T3 ON T2.DepartmentID = T3.DepartmentID WHERE T1.JobTitle = 'Senior Tool Designer' AND STRFTIME('%Y', T1.HireDate) - STRFTIME('%Y', T1.BirthDate) = 33 AND T2.EndDate IS NOT NULL
Database: works_cycles
Question: Among the vendors with an average credit rating, what is the overall total due amount of purchases made by the company to the vendor that isn't preferrerd if another vendor is available?
Evidence: average credit rating refers to CreditRating = 4;  vendor that isn't preferrerd if another vendor is available refers to PreferredVendorStatus = 0; SUM(TotalDue);
SQL: SELECT SUM(T2.TotalDue) FROM Vendor AS T1 INNER JOIN PurchaseOrderHeader AS T2 ON T1.BusinessEntityID = T2.VendorID WHERE T1.CreditRating = 4 AND T1.PreferredVendorStatus = 0
Database: works_cycles
Question: Which department has the most number of night shifts?
Evidence: most number of night shift = MAX(count(shift.Name = 'Night'))
SQL: SELECT T3.Name FROM Shift AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.ShiftId = T2.ShiftId INNER JOIN Department AS T3 ON T2.DepartmentID = T3.DepartmentID GROUP BY T2.DepartmentID ORDER BY COUNT(T1.Name = 'Night') DESC LIMIT 1
Database: works_cycles
Question: How much profit can the company gained from selling two high class black Road Bikes with a size of 58?
Evidence: high class refers to Class = 'H"; road bikes is a name of product subcategory; profit = (MULTIPLY(SUBTRACT(ListPrice, StandardCost)), (2)));
SQL: SELECT 2 * (T1.ListPrice - T1.StandardCost) FROM Product AS T1 INNER JOIN ProductSubcategory AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID WHERE T1.Class = 'H' AND T1.Color = 'Black' AND T1.Size = 58 AND T2.Name = 'Road Bikes'
Database: works_cycles
Question: What are the full names of the 10 youngest married male production technicians?
Evidence: youngest refers to latest BirthDate; married refers to MaritalStatus = 'M'; production technician is a JobTitle; full name = FirstName+MiddleName+LastName;
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 LIKE 'Production Technician%' AND T1.Gender = 'M' AND T1.MaritalStatus = 'M' ORDER BY T1.BirthDate DESC LIMIT 10
Database: works_cycles
Question: Among the products with an average lead time of 60, which vendor has the highest profit on net? Indicate the credit rating of such vendor.
Evidence: profit on net = SUBTRACT(LastReceiptCost, StandardPrice);
SQL: SELECT T2.Name, T2.CreditRating FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.AverageLeadTime = 60 ORDER BY T1.LastReceiptCost - T1.StandardPrice DESC LIMIT 1
Database: works_cycles
Question: What is the profit on net of the products that have exactly 200 maximum order quantity? Indicate the name of the vendors to which these products were purchased from.
Evidence: maximum orders refers to MaxOrderQty; MaxOrderQty = 200; profit on net = SUBTRACT(LastReceiptCost, StandardPrice);
SQL: SELECT T1.LastReceiptCost - T1.StandardPrice, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.MaxOrderQty = 200
Database: works_cycles
Question: What is the full name of the non-sales employee who made the most number of rejected purchase orders?
Evidence: non-sales employee refers to PersonType = 'EM'; rejected purchase order refers to Status = 3;
SQL: SELECT T2.FirstName, T2.LastName FROM PurchaseOrderHeader AS T1 INNER JOIN Person AS T2 ON T1.EmployeeID = T2.BusinessEntityID WHERE T2.PersonType = 'EM' AND T1.Status = 3 GROUP BY T2.FirstName, T2.LastName ORDER BY COUNT(T1.PurchaseOrderID) DESC LIMIT 1
Database: works_cycles
Question: What are the names of the vendor with the second lowest minimum order quantity?
Evidence: minimum order quantity refers to MinOrderQty;
SQL: SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.MaxOrderQty ASC LIMIT 1, 1
Database: works_cycles
Question: How much are the minimum orders of the vendors that are no longer used by the company?
Evidence: vendors that are no longer used by the company refers to ActiveFlag = 0;
SQL: SELECT T2.MinOrderQty FROM Vendor AS T1 INNER JOIN ProductVendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.ActiveFlag = 0 ORDER BY T2.MinOrderQty LIMIT 1
Database: works_cycles
Question: Of the employees whose vacation hours are no more than 10, what is the age of the oldest employee at the time he/she was hired? Indicate his/her full name.
Evidence: VacationHours<10; age at the time of being hired = SUBTRACT(year(HireDate), year(BirthDate)); full name = FirstName+MiddleName+LastName;
SQL: SELECT STRFTIME('%Y', T1.HireDate) - STRFTIME('%Y', T1.BirthDate), T2.FirstName, T2.MiddleName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.VacationHours <= 10 ORDER BY STRFTIME('%Y', T1.HireDate) - STRFTIME('%Y', T1.BirthDate) DESC LIMIT 1
Database: works_cycles
Question: What is the primary type of all single female employees hired between 1/1/2008 to 12/31/2008?
Evidence: primary type refers to PersonType; single refers to MaritalStatus = 'S"; female refers to Gender = 'F'; HireDate BETWEEN '2010-1-1'AND '2010-12-31';
SQL: SELECT T2.PersonType FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Gender = 'F' AND T1.MaritalStatus = 'S' AND STRFTIME('%Y-%m-%d', T1.HireDate) BETWEEN '2008-1-1' AND '2008-12-31' GROUP BY T2.PersonType ORDER BY COUNT(T2.PersonType) DESC LIMIT 1
Database: works_cycles
Question: What is the company's profit on the product that was rated second-highest by David?
Evidence: profit on net on a single product = SUBTRACT(ListPrice, StandardCost); second highest rating refers to Rating = 4; David is the ReviewerName;
SQL: SELECT T2.ListPrice - T2.StandardCost FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ReviewerName = 'David' ORDER BY T1.Rating DESC LIMIT 1
Database: works_cycles
Question: Which geographic area does the city with the second lowest tax rate belongs to? Indicate the name of the state or province as well.
Evidence: geographic area to which the city belong refers to Group;
SQL: SELECT T3.'Group', T2.Name FROM SalesTaxRate AS T1 INNER JOIN StateProvince AS T2 ON T1.StateProvinceID = T2.StateProvinceID INNER JOIN SalesTerritory AS T3 ON T2.TerritoryID = T3.TerritoryID ORDER BY T1.TaxRate LIMIT 1, 1
Database: works_cycles
Question: What is the average profit of all the low class universal road frames? Indicate how many variety of sizes are there and the available colors.
Evidence: low class refers to Class = 'L'; universal refers to Style = 'U'; road frame is a name of product subcategory; average profit = AVG(SUBTRACT(ListPrice, StandardCost);
SQL: SELECT AVG(T1.ListPrice - T1.StandardCost), COUNT(DISTINCT T1.Size) , COUNT(DISTINCT T1.Style) FROM Product AS T1 INNER JOIN ProductSubcategory AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID WHERE T1.Class = 'L' AND T2.Name = 'Road Frames' GROUP BY T1.Class, T1.Color
Database: works_cycles
Question: What is the discount percentage of "LL Road Frame Sale"?
Evidence: discount percentage refers to DiscountPct; LL Road Frame Sale is a description of special offer;
SQL: SELECT DiscountPct FROM SpecialOffer WHERE Description = 'LL Road Frame Sale'
Database: works_cycles
Question: How many discount are of the type "Excess Inventory"?
Evidence: discount refers to DiscountPct; Excess Inventory is a type of special offer;
SQL: SELECT COUNT(SpecialOfferID) FROM SpecialOffer WHERE Type = 'Excess Inventory'
Database: works_cycles
Question: Which seasonal discount had the highest discount percentage?
Evidence: seasonal discount is a type of special offer; discount percentage refers to DiscountPct; highest discount percentage refers to MAX(DiscountPct);
SQL: SELECT Description FROM SpecialOffer WHERE Type = 'Seasonal Discount' ORDER BY DiscountPct DESC LIMIT 1
Database: works_cycles
Question: Please list the top 3 discounts with the highest discount percentage and fall under the reseller category.
Evidence: discount percentage refers to DiscountPct; highest discount percentage refers to MAX(DiscountPct);
SQL: SELECT Description, DiscountPct FROM SpecialOffer WHERE Category = 'Reseller' ORDER BY DiscountPct DESC LIMIT 0, 3
Database: works_cycles
Question: Where can I get the demographic information about the Valley Bicycle Specialists store?
Evidence: Valley Bicycle Specialists is a name of a store;
SQL: SELECT Demographics FROM Store WHERE Name = 'Valley Bicycle Specialists'
Database: works_cycles
Question: Among all the products that are manufactured in-house, how many of them are salable?
Evidence: product is mnanufactured in-house refers to MakeFlag = 1; salable product refers to FinishedGoodsFlag = 1;
SQL: SELECT SUM(FinishedGoodsFlag) FROM Product WHERE MakeFlag = 1
Database: works_cycles
Question: What is the minimum inventory quantity of Chainring Bolts?
Evidence: minimum inventory quantity refers to SafetyStockLevel; chainring bolts is a name of product;
SQL: SELECT SafetyStockLevel FROM Product WHERE Name = 'Chainring Bolts'
Database: works_cycles
Question: Which product has the highest standard cost?
SQL: SELECT Name FROM Product ORDER BY StandardCost DESC LIMIT 1
Database: works_cycles
Question: What type of employee is David Bradley?
Evidence: type of employee refers to PersonType;
SQL: SELECT PersonType FROM Person WHERE FirstName = 'David' AND LastName = 'Bradley'
Database: works_cycles
Question: Among the employees who are store contacts, how many of them have a title of "Mr."?
Evidence: store contact refers to PersonType = 'SC';
SQL: SELECT COUNT(BusinessEntityID) FROM Person WHERE PersonType = 'SC' AND Title = 'Mr.'
Database: works_cycles
Question: Where can I find the Valley Bicycle Specialists store?
Evidence: Valley Bicycle Specialists is a name of store; full address = AddressLine1+AddressLine2;
SQL: SELECT T2.AddressLine1, T2.AddressLine2 FROM BusinessEntityAddress AS T1 INNER JOIN Address AS T2 ON T1.AddressID = T2.AddressID INNER JOIN Store AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T3.Name = 'Valley Bicycle Specialists'
Database: works_cycles
Question: To which e-mail address should I write if I want to contact David Bradley?
SQL: SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'David' AND T1.LastName = 'Bradley'
Database: works_cycles
Question: Please list the phone numbers of all the store contacts.
Evidence: store contact refers to PersonType = 'SC';
SQL: SELECT T2.PhoneNumber FROM Person AS T1 INNER JOIN PersonPhone AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SC'
Database: works_cycles
Question: What is the hashed password of David Bradley?
Evidence: hashed password refers to PasswordHash;
SQL: SELECT T2.PasswordHash FROM Person AS T1 INNER JOIN Password AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'David' AND T1.LastName = 'Bradley'
Database: works_cycles
Question: Please list the e-mail addresses of all the employees who wish to receive e-mail promotions from Adventureworks and selected partners.
Evidence: employees who wish to receive e-mail promotions from AdventureWorks and selected partners refers to EmailPromotion = 2;
SQL: SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.EmailPromotion = 2
Database: works_cycles
Question: Please show the credit card number of David Bradley.
Evidence: credit card number refers to CardNumber;
SQL: SELECT T3.CardNumber 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 = 'David' AND T1.LastName = 'Bradley'
Database: works_cycles
Question: In which year will the David Bradley's credit card expire?
Evidence: year of credit card expiration refers to ExpYear;
SQL: SELECT T3.ExpYear 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 = 'David' AND T1.LastName = 'Bradley'
Database: works_cycles
Question: Please list the names of all the store contact employees whose credit cards expired in 2007.
Evidence: year of credit card expiration refers to ExpYear; ExpYear = 2007; store contact refers to PersonType = 'SC';
SQL: SELECT T1.FirstName, T1.LastName 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 T3.ExpYear = 2007 AND T1.PersonType = 'SC'
Database: works_cycles
Question: Among the store contact employees, how many of them have a Vista credit card?
Evidence: store contact refers to PersonType = 'SC'; type of credit card refers to CardType; CardType = 'vista';
SQL: SELECT COUNT(T1.FirstName) 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 T3.CardType = 'Vista' AND T1.PersonType = 'SC'
Database: works_cycles
Question: How many departments have David Bradley been in?
SQL: SELECT COUNT(T3.DepartmentID) 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 = 'David' AND T1.LastName = 'Bradley'
Database: works_cycles
Question: Please list the departments that David Bradley used to belong to.
SQL: SELECT T2.DepartmentID 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 = 'David' AND T1.LastName = 'Bradley'
Database: works_cycles
Question: How many people were there in the Engineering Department in the year 2009?
Evidence: year(EndDate)>2009 and year(StartDate)<2009;
SQL: SELECT COUNT(T1.BusinessEntityID) 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 T3.Name = 'Engineering' AND STRFTIME('%Y', T2.EndDate) > '2009' AND STRFTIME('%Y', T2.StartDate) < '2009'
Database: works_cycles
Question: Which employee has been in the Engineering Department the longest? Please give his or her firstname and lastname.
Evidence: length of stay in a department = SUBTRACT(EndDate, StartDate);
SQL: SELECT T1.FirstName, T1.LastName 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 T3.Name = 'Engineering' ORDER BY T2.EndDate - T2.StartDate DESC LIMIT 1
Database: works_cycles
Question: Among the employees in the Manufacturing group in 2007, how many of them are store contacts?
Evidence: store contact refers to PersonType = 'SC'; year(EndDate)>2007 and year(StartDate)<2007;
SQL: SELECT COUNT(T1.BusinessEntityID) FROM EmployeeDepartmentHistory AS T1 INNER JOIN Department AS T2 ON T1.DepartmentID = T2.DepartmentID INNER JOIN Person AS T3 ON T1.BusinessEntityID WHERE T3.PersonType = 'SC' AND T2.GroupName = 'Manufacturing' AND STRFTIME('%Y', T1.EndDate) >= '2007' AND STRFTIME('%Y', T1.StartDate) <= '2007'
Database: works_cycles
Question: Please list the credit card numbers of all the employees who have left the Finance Department.
Evidence: credit card number refers to CardNumber; employees who left the department refers to EndDate NOT null; Engineering Department is a name of department;
SQL: SELECT T3.CardNumber FROM EmployeeDepartmentHistory AS T1 INNER JOIN Department AS T2 ON T1.DepartmentID = T2.DepartmentID INNER JOIN CreditCard AS T3 ON T1.ModifiedDate = T3.ModifiedDate INNER JOIN PersonCreditCard AS T4 ON T3.CreditCardID = T4.CreditCardID WHERE T2.Name = 'Finance' AND T1.EndDate IS NOT NULL
Database: works_cycles
Question: How many employees working in the Engineering Department in 2007 would have their credit cards expired in the same year?
Evidence: year(StartDate) 2007; year of credit card expiration refers to ExpYear; ExpYear = 2007;
SQL: SELECT COUNT(T1.BusinessEntityID) FROM EmployeeDepartmentHistory AS T1 INNER JOIN Department AS T2 ON T1.DepartmentID = T2.DepartmentID INNER JOIN PersonCreditCard AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID INNER JOIN CreditCard AS T4 ON T3.CreditCardID = T4.CreditCardID WHERE T4.ExpYear = 2007 AND T2.Name = 'Engineering'
Database: works_cycles
Question: What is the e-mail address of the employee who switched departments for the most times?
Evidence: switched department the most refers to MAX(count(DepartmentID));
SQL: SELECT T2.EmailAddress FROM EmployeeDepartmentHistory AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID GROUP BY T2.BusinessEntityID ORDER BY COUNT(T1.DepartmentID) DESC LIMIT 1
Database: works_cycles
Question: Among all the employees who don't wish to receive promotion e-mails, how many of them belong to or once belonged to the Engineering Department?
Evidence: Employees who don't wish to receive e-mail promotions refers to EmailPromotion = 0;
SQL: SELECT COUNT(T1.BusinessEntityID) FROM EmployeeDepartmentHistory AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Department AS T3 ON T1.DepartmentID = T3.DepartmentID WHERE T3.Name = 'Engineering' AND T2.EmailPromotion = 0
Database: works_cycles
Question: How many employees came into the Quality Assurance Group in the year 2007?
Evidence: Quality Assurance Group is a group name of department; came in 2007 refers to year(StartDate) = 2007;
SQL: SELECT COUNT(T1.BusinessEntityID) FROM EmployeeDepartmentHistory AS T1 INNER JOIN Department AS T2 ON T1.DepartmentID = T2.DepartmentID WHERE T2.GroupName = 'Quality Assurance' AND STRFTIME('%Y', T1.StartDate) = '2007'
Database: works_cycles
Question: Please list the product names of all the products on the LL Road Frame Sale.
Evidence: LL Road Frame Sale is a description of special offer
SQL: SELECT T3.Name FROM SpecialOffer AS T1 INNER JOIN SpecialOfferProduct AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID INNER JOIN Product AS T3 ON T2.ProductID = T3.ProductID WHERE T1.Description = 'LL Road Frame Sale'
Database: works_cycles
Question: How many products were on the LL Road Frame Sale?
Evidence: LL Road Frame Sale is a description of special offer
SQL: SELECT COUNT(DISTINCT ProductID) FROM SpecialOffer AS T1 INNER JOIN SpecialOfferProduct AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID WHERE T1.Description = 'LL Road Frame Sale'
Database: works_cycles
Question: Has the product Chainring Bolts been on any of the sales?
Evidence: a product that's been on sale refers to SellStartDate NOT null and vice versa;
SQL: SELECT CASE WHEN COUNT(T1.Description) >= 1 THEN 'Yes' ELSE 'No' END FROM SpecialOffer AS T1 INNER JOIN SpecialOfferProduct AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID INNER JOIN Product AS T3 ON T2.ProductID = T3.ProductID WHERE T3.Name = 'Chainring Bolts'
Database: works_cycles
Question: How many products from the Clothing category were on the LL Road Frame Sale?
Evidence: LL Road Frame Sale is a description of special offer
SQL: SELECT COUNT(T2.ProductID) FROM SpecialOffer AS T1 INNER JOIN SpecialOfferProduct AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID INNER JOIN Product AS T3 ON T2.ProductID = T3.ProductID INNER JOIN ProductSubcategory AS T4 ON T3.ProductSubcategoryID = T4.ProductSubcategoryID INNER JOIN ProductCategory AS T5 ON T4.ProductCategoryID = T5.ProductCategoryID WHERE T1.Description = 'LL Road Frame Sale' AND T4.Name = 'Clothing'
Database: works_cycles
Question: Please list the products that are under the Clothing category that are manufactured in-house and salable.
Evidence: product is manufactured in-house refers to MakeFlag = 1; salable product refers to FinishedGoodsFlag = 1;
SQL: SELECT CASE WHEN T1.MakeFlag = 1 THEN T1.Name END FROM Product AS T1 INNER JOIN ProductSubcategory AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID INNER JOIN ProductCategory AS T3 ON T2.ProductCategoryID = T3.ProductCategoryID WHERE T2.ProductSubcategoryID = 3
Database: works_cycles
Question: For all the employees that have left the Engineering Department, what is the average time of their stay?
Evidence: employees who left a department refers to EndDate NOT null; average stay = AVG(SUBTRACT(year(EndDate)), (year(T1.StartDate)));
SQL: SELECT CAST(SUM(365 * (STRFTIME('%Y', T1.EndDate) - STRFTIME('%Y', T1.StartDate)) + 30 * (STRFTIME('%m', T1.EndDate) - STRFTIME('%m', T1.StartDate)) + STRFTIME('%d', T1.EndDate) - STRFTIME('%d', T1.StartDate)) AS REAL) / COUNT(T1.BusinessEntityID) FROM EmployeeDepartmentHistory AS T1 INNER JOIN Department AS T2 ON T1.DepartmentID = T2.DepartmentID WHERE T2.Name = 'Engineering' AND T1.EndDate IS NOT NULL
Database: works_cycles
Question: What is the average pay rate of the employees who worked in the Engineering Departmentin 2007?
Evidence: average pay rate = AVG(Rate); work in 2007 refers to year(StartDate)<2007 AND year(EndDate)>2007;
SQL: SELECT AVG(T3.Rate) FROM EmployeeDepartmentHistory AS T1 INNER JOIN Department AS T2 ON T1.DepartmentID = T2.DepartmentID INNER JOIN EmployeePayHistory AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T2.Name = 'Engineering' AND STRFTIME('%Y', EndDate) > '2007' AND STRFTIME('%Y', T1.StartDate) < '2007'
Database: works_cycles
Question: How much more expensive in percentage is the product with the highest selling price from the product with the lowest selling price in the Clothing category?
Evidence: selling price refers to ListPrice; highest selling price refers to MAX(ListPrice); lowest selling price refers to MIN(ListPrice);
SQL: SELECT (MAX(T1.ListPrice) - MIN(T1.ListPrice)) * 100 / MIN(T1.ListPrice) FROM Product AS T1 INNER JOIN ProductSubcategory AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID INNER JOIN ProductCategory AS T3 ON T2.ProductCategoryID = T3.ProductCategoryID WHERE T3.Name = 'Clothing'