Chinastark/bird_dataset huggingface dataset:
Database: works_cycles
Question: Name the oldest employee who is working on night shift. How old is the employee?
Evidence: working on night shift refers to ShiftID = 3; oldest employee refers to min(BirthDate); age = 2022-year(BirthDate)+1
SQL: SELECT T1.FirstName, T1.LastName , STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', BirthDate) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmployeeDepartmentHistory AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T3.ShiftId = 3 ORDER BY STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', BirthDate) DESC LIMIT 1
Database: works_cycles
Question: List all staff in the Shipping and Receiving department who are hired in 2009.
Evidence: hired in 2009 refers to year(HireDate) = 2009
SQL: SELECT T1.FirstName, T1.LastName FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmployeeDepartmentHistory AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID INNER JOIN Department AS T4 ON T3.DepartmentID = T4.DepartmentID WHERE STRFTIME('%Y', T2.HireDate) = '2009' AND T4.Name = 'Shipping and Receiving'
Database: works_cycles
Question: What is the job title of the oldest employee in the company? In which department is he in?
Evidence: oldest employee refers to min(BirthDate)
SQL: SELECT T2.JobTitle, T4.Name FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmployeeDepartmentHistory AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID INNER JOIN Department AS T4 ON T3.DepartmentID = T4.DepartmentID ORDER BY T2.HireDate LIMIT 1
Database: works_cycles
Question: Based on the lastet payrate of each employee, calculate the average hourly payrate for each department.
Evidence: latest payrate refers to max(RateChangeDate); average hourly payrate = divide(sum(Rate), count(BusinessEntityID)) for each DepartmentID
SQL: SELECT AVG(T1.Rate) FROM EmployeePayHistory AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Department AS T3 ON T2.DepartmentID = T3.DepartmentID WHERE T1.RateChangeDate = ( SELECT MAX(T1.RateChangeDate) FROM EmployeePayHistory AS T1 INNER JOIN Department AS T2 ON T1.BusinessEntityID = T2.DepartmentID )
Database: works_cycles
Question: Other than the Chief Executive Officer, who is the employee who has the highest payrate? State the rate.
Evidence: other than the Chief Executive Officer refers to JobTitle! = 'Chief Executive Officer'; highest payrate refers to max(Rate)
SQL: SELECT T2.FirstName, T2.LastName FROM EmployeePayHistory AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Employee AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T3.JobTitle NOT LIKE 'Chief Executive Officer' ORDER BY T1.Rate DESC LIMIT 1
Database: works_cycles
Question: Name the vendor who has the shortest average lead time for Product ID 319.
SQL: SELECT T1.Name FROM Vendor AS T1 INNER JOIN ProductVendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.ProductID = 319 ORDER BY T2.AverageLeadTime LIMIT 1
Database: works_cycles
Question: List all product name from Australia Bike Retailer order by product ID.
Evidence: Australia Bike Retailer is name of vendor
SQL: SELECT T3.Name FROM Vendor AS T1 INNER JOIN ProductVendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Product AS T3 ON T2.ProductID = T3.ProductID WHERE T1.Name = 'Australia Bike Retailer'
Database: works_cycles
Question: Which vendor gives the best profit on net for product ID 342?
Evidence: profit on net = subtract(LastReceiptCost, StandardPrice); best profit on net refers to max(subtract(LastReceiptCost, StandardPrice))
SQL: SELECT T1.Name FROM Vendor AS T1 INNER JOIN ProductVendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.ProductID = 342 ORDER BY T2.LastReceiptCost - T2.StandardPrice DESC LIMIT 1
Database: works_cycles
Question: What is the current payrate of Rob Walters? Calculate the percentage increment from his previous payrate.
Evidence: current payrate refers to max(Rate); percentage increment = divide(subtract(max(Rate), min(Rate)), min(Rate))*100%
SQL: SELECT T2.Rate , (MAX(T2.Rate) - MIN(T2.Rate)) * 100 / MAX(T2.Rate) FROM Person AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Rob' AND T1.LastName = 'Walters'
Database: works_cycles
Question: Calculate the average length of employment for employee working in the Research and Development deparment.
Evidence: average length of employment = AVG(subtract(2022, year(HireDate)))
SQL: SELECT AVG(STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', T1.HireDate)) 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 T3.Name = 'Research and Development'
Database: works_cycles
Question: What is the average age of employee in Adventure Works?
Evidence: average age = AVG(subtract(year(now), year(HireDate)))
SQL: SELECT AVG(STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', BirthDate)) FROM Employee
Database: works_cycles
Question: Among the employees in Adventure Works, calculate the percentage of them working as sales representatives.
Evidence: percentage of sales representatives = divide(count(JobTitle = 'Sales Representative'), count(JobTitle))*100%
SQL: SELECT CAST(SUM(CASE WHEN JobTitle = 'Sales Representative' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(BusinessEntityID) FROM Employee
Database: works_cycles
Question: Please provide contact details of all Marketing Managers. State their name and phone number.
Evidence: Marketing Manager is a job title
SQL: SELECT T1.FirstName, T1.LastName, T2.PhoneNumber FROM Person AS T1 INNER JOIN PersonPhone AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Employee AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T3.JobTitle = 'Marketing Manager'
Database: works_cycles
Question: List the person who owns a distinguish credt card.
Evidence: distinguish credt card refers to cardType = 'Distinguish'
SQL: SELECT T3.FirstName, T3.LastName FROM CreditCard AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID INNER JOIN Person AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.CardType = 'Distinguish'
Database: works_cycles
Question: Name the sales person for store Area Bike Accessories. Which territory is he / she in?
SQL: SELECT T4.Name FROM Store AS T1 INNER JOIN SalesPerson AS T2 ON T1.SalesPersonID = T2.BusinessEntityID INNER JOIN Person AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID INNER JOIN SalesTerritory AS T4 ON T2.TerritoryID = T4.TerritoryID WHERE T1.Name = 'Area Bike Accessories'
Database: works_cycles
Question: Name all stores and its sales representative in France territory.
Evidence: France territory refers to SalesTerritory.Name = 'France';
SQL: SELECT T3.Name, T4.FirstName, T4.LastName FROM SalesTerritory AS T1 INNER JOIN Customer AS T2 ON T1.TerritoryID = T2.TerritoryID INNER JOIN Store AS T3 ON T2.StoreID = T3.BusinessEntityID INNER JOIN Person AS T4 ON T2.PersonID = T4.BusinessEntityID WHERE T1.Name = 'France'
Database: works_cycles
Question: Name all products that started selling in 2013. State its respective vendor's name.
Evidence: Started selling in 2013 refers to year(SellStartDate) = 2013;
SQL: SELECT T1.Name, T3.Name FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE STRFTIME('%Y', T1.SellStartDate) = '2013'
Database: works_cycles
Question: Names the Sales Representative with the highest year to date sales.
Evidence: Highest year to date sales refers to Max(SalesYTD);
SQL: SELECT T2.FirstName, T2.MiddleName, T2.LastName FROM SalesPerson AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.SalesYTD DESC LIMIT 1
Database: works_cycles
Question: List all product only MOQ of 1,000 and with standard cost more than 17.
Evidence: MOQ refers to minimum order quantity; MOQ of 1 refers to MinOrderQty = 1; standard cost more than 48 refers to StandardCost > 48;
SQL: SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T1.MaxOrderQty = 1000 AND T2.StandardCost > 17
Database: works_cycles
Question: Who is the oldest married male? State his job title.
Evidence: Male refers to Gender = 'M'; married refers to MaritalStatus = 'M'; oldest refers to Min(BirthDate);
SQL: SELECT T2.FirstName, T2.LastName, T1.JobTitle FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Gender = 'M' AND T1.MaritalStatus = 'M' ORDER BY T1.BirthDate LIMIT 1
Database: works_cycles
Question: State the vendor for product number WB-H098.
SQL: SELECT T3.Name FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.ProductNumber = 'WB-H098'
Database: works_cycles
Question: Find the vendor with the least average lead time for Product ID 348.
SQL: SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.ProductID = 348 ORDER BY T1.AverageLeadTime ASC LIMIT 1
Database: works_cycles
Question: State the employee who are born in or after 1970 and with the least sick leave hour.
Evidence: born in or after 1970 refers to year(BirthDate) > = 1970;
SQL: SELECT T2.FirstName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T1.BirthDate) > '1970' ORDER BY T1.SickLeaveHours LIMIT 1
Database: works_cycles
Question: Calculate the average age of employee in each department and state which department has the youngest employees.
Evidence: Average = Divide(Sum(Substract(year(@today),year(BirthDate))),Count(BusinessEntityID) by each Department ID; youngest employee refers to Min(BirthDate);
SQL: SELECT STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', T1.BirthDate) + 1 , T3.Name FROM Employee AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 USING (BusinessEntityID) INNER JOIN Department AS T3 USING (DepartmentID) ORDER BY T1.BirthDate DESC LIMIT 1
Database: works_cycles
Question: Please provide the IDs of any three AdventureWorks product subcategories.
SQL: SELECT DISTINCT ProductCategoryID FROM ProductSubcategory LIMIT 3
Database: works_cycles
Question: What are the differences between the 288th salesperson's predicted annual sales and his or her actual sales thus far?
Evidence: 288th sales person refers to BusinessEntityID = 288; predited annual sales refers to SalesQuota; actual sales refers to SalesYTD; difference = Substract(SalesQuota(BusinessEntityID(288))), (SalesYTD(BusinessEntityID(288)));
SQL: SELECT SalesYTD - SalesQuota FROM SalesPerson WHERE BusinessEntityID = 288
Database: works_cycles
Question: Please list three businesses with the lowest total sales from last year.
Evidence: lowest total sales in last year refers to Min(SalesLastYear);
SQL: SELECT BusinessEntityID FROM SalesPerson ORDER BY SalesLastYear LIMIT 3
Database: works_cycles
Question: Which three sales regions have generated the most revenue thus far?
Evidence: revenue refers to SalesYTD; the most revenue refers to Max(SalesYTD);
SQL: SELECT TerritoryID FROM SalesTerritory ORDER BY SalesYTD DESC LIMIT 3
Database: works_cycles
Question: What categories of offers qualify for group discounts for resellers?
Evidence: resellers refers to Category = 'Reseller';
SQL: SELECT Type FROM SpecialOffer WHERE Category = 'Reseller'
Database: works_cycles
Question: What is the highest possible discount rate for 'Excess Inventory'?
Evidence: excess inventory refers to Type = 'Excess Inventory'; highest possible discount refers to Max(DiscountPct);
SQL: SELECT DiscountPct FROM SpecialOffer WHERE Type = 'Excess Inventory' ORDER BY DiscountPct DESC LIMIT 1
Database: works_cycles
Question: What is the difference between the actual manufacturing cost of product number 818 and the estimated manufacturing cost?
Evidence: product number 818 refers to ProductID = 818; estimated manufacturing cost refers PlannedCost; actual manufacturing cost refers to ActualCost; difference = Substract(PlannedCost(ProductID(818))),(ActualCost(ProductID(818)));
SQL: SELECT PlannedCost - ActualCost FROM WorkOrderRouting WHERE ProductID = 818
Database: works_cycles
Question: How many materials still need to be assembled and have a depth of 2 between each component and their parent product?
Evidence: still need to be assembled means the assembly doesn't finish or still going on which refers to EndDate IS NULL; a depth of 2 refers to BOMLevel = 2;
SQL: SELECT COUNT(*) FROM BillOfMaterials WHERE BOMLevel = 2 AND EndDate IS NULL
Database: works_cycles
Question: How many of the approved documents are confidential?
Evidence: approved refers to Status = 2; confidential document refers to DocumentSummary is null;
SQL: SELECT COUNT(DocumentNode) FROM Document WHERE Status = 2 AND DocumentSummary IS NULL
Database: works_cycles
Question: What are the sales tax records charged by multiple types of tax?
Evidence: multiple types of tax refers to Name like '%+%';

SQL: SELECT SalesTaxRateID FROM SalesTaxRate WHERE Name LIKE '%+%'
Database: works_cycles
Question: Which work order transaction number has the highest product quantity?
Evidence: work order transaction refers to TransactionType = 'W';
SQL: SELECT TransactionID FROM TransactionHistory WHERE TransactionType = 'W' ORDER BY Quantity DESC LIMIT 1
Database: works_cycles
Question: Please list any 3 vendors that are not recommended by Adventure Works.
Evidence: not recommended refers to PreferredVendorStatus = 0;
SQL: SELECT Name FROM Vendor WHERE PreferredVendorStatus = 0 LIMIT 3
Database: works_cycles
Question: How many vendors does Adventure Works still work with but are not preferable?
Evidence: not preferable refers to PreferredVendorStatus = 0; still work refers to ActiveFlag = 1;
SQL: SELECT COUNT(BusinessEntityID) FROM Vendor WHERE PreferredVendorStatus = 0 AND ActiveFlag = 1
Database: works_cycles
Question: How many employees who began working in 2009 or later had night shifts?
Evidence: began work in 2009 or later refers to StartDate> = 2009;
SQL: SELECT COUNT(T1.BusinessEntityID) FROM EmployeeDepartmentHistory AS T1 INNER JOIN Shift AS T2 ON T1.ShiftId = T2.ShiftId WHERE T2.ShiftId = 3 AND STRFTIME('%Y', T2.StartTime) >= '2009'
Database: works_cycles
Question: Which department, altogether, has the most personnel who work the evening shift?
Evidence: evening shift also means night shift where Name = 'Night';most personnel in evening shift refers to Max(Count(Shift.ShiftID(Name = 'Night')));
SQL: SELECT T3.Name FROM EmployeeDepartmentHistory AS T1 INNER JOIN Shift AS T2 ON T1.ShiftId = T2.ShiftId INNER JOIN Department AS T3 ON T1.DepartmentID = T3.DepartmentID WHERE T2.Name = 'Night' GROUP BY T3.Name ORDER BY COUNT(T1.BusinessEntityID) DESC LIMIT 1
Database: works_cycles
Question: How many shipments by truck were made?
Evidence: shipment by truck refers to Name = 'XRQ - TRUCK GROUND';
SQL: SELECT COUNT(*) FROM ShipMethod AS T1 INNER JOIN SalesOrderHeader AS T2 USING (ShipMethodID) WHERE T1.Name = 'XRQ - TRUCK GROUND'
Database: works_cycles
Question: What are the sales reasons for order 43718?
Evidence: order refers to SalesOrderID
SQL: SELECT T2.Name FROM SalesOrderHeaderSalesReason AS T1 INNER JOIN SalesReason AS T2 ON T1.SalesReasonID = T2.SalesReasonID WHERE T1.SalesOrderID = 43718
Database: works_cycles
Question: What bike subcategories are there?
Evidence: bikes is product category
SQL: SELECT T1.Name FROM ProductSubcategory AS T1 INNER JOIN ProductCategory AS T2 ON T1.ProductCategoryID = T2.ProductCategoryID WHERE T2.name = 'Bikes'
Database: works_cycles
Question: Which sales areas are expected to have the highest yearly sales quota?
Evidence: highest yearly sales quota refers to Max(SalesQuota);
SQL: SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID GROUP BY T1.TerritoryID ORDER BY SUM(T1.SalesQuota) DESC LIMIT 1
Database: works_cycles
Question: What goods were sold to customers in accordance with sales order number 43660?
Evidence: goods refers to products
SQL: SELECT T1.Name FROM Product AS T1 INNER JOIN SalesOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.SalesOrderID = 43660
Database: works_cycles
Question: Please list the top 5 products with the most orders.
Evidence: most order refers to Max(OrderQty);
SQL: SELECT T1.Name FROM Product AS T1 INNER JOIN SalesOrderDetail AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.Name ORDER BY SUM(T2.OrderQty) DESC LIMIT 0, 5
Database: works_cycles
Question: Where are the shelves where the down tube product was stored?
Evidence: shelves refer to shelf; down tube is a product
SQL: SELECT T2.Shelf FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'
Database: works_cycles
Question: Which address type does "Fun Toys and Bikes" fall under?
Evidence: Fun Toys and Bikes is name of a store
SQL: SELECT T2.Name FROM BusinessEntityAddress AS T1 INNER JOIN AddressType AS T2 ON T1.AddressTypeID = T2.AddressTypeID INNER JOIN Store AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T3.Name = 'Fun Toys and Bikes'
Database: works_cycles
Question: Who is the "Next-Door Bike Store" point of contact?
Evidence: Next-Door Bike Store is name of a store
SQL: SELECT T1.Name FROM ContactType AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.ContactTypeID = T2.ContactTypeID INNER JOIN Store AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T3.Name = 'Next-Door Bike Store'
Database: works_cycles
Question: What is the order reference number for the "Mountain End Caps" product?
Evidence: Order Reference Number refers to ReferenceOrderID
SQL: SELECT T2.ReferenceOrderID FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Mountain End Caps'
Database: works_cycles
Question: What is the 12th business's first line address?
Evidence: 12th business refers to BusinessEntityID = 12;
SQL: SELECT T1.AddressLine1 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T2.BusinessEntityID = 12
Database: works_cycles
Question: Please list any three businesses with their IDs that are located in Dallas City.
Evidence: business with ther ID refers to BusinessEntityID
SQL: SELECT T2.BusinessEntityID FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T1.City = 'Dallas' LIMIT 3
Database: works_cycles
Question: What is the name of the state that Racine belongs to?
Evidence: Racine is a city
SQL: SELECT T2.Name FROM Address AS T1 INNER JOIN StateProvince AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T1.City = 'Racine'
Database: works_cycles
Question: What is the difference in percentage between the product descriptions written in Arabic and Thai?
Evidence: Arabic and Thai are language names refers to name = 'Arabic'and name = 'Thai'; Differencce in percentage = Subtract(((Count(CultureID(name = 'Arabic'))/Count(CultureID))*100),((Count(CultureID(name = 'Thai'))/Count(CultureID))*100)));
SQL: SELECT CAST(SUM(CASE WHEN T1.Name = 'Arabic' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T1.Name = 'Thai' THEN 1 ELSE 0 END) FROM Culture AS T1 INNER JOIN ProductModelProductDescriptionCulture AS T2 ON T1.CultureID = T2.CultureID
Database: works_cycles
Question: What percentage of businesses in the Northwest US have forecasted annual sales of above 300,000?
Evidence: Northwest refers to Name = 'Northwest'; US refers to CountryRegionCode = 'US'; forecasted annual sales of above 300,000 refers to SalesQuota >300000; Percentage = Divide(Count(TerritoryID(SalesQuota >300000)),Count(TerritoryID))*100
SQL: SELECT CAST(SUM(CASE WHEN T1.SalesQuota > 300000 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessEntityID) FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T2.CountryRegionCode = 'US' AND T2.Name = 'Northwest'
Database: works_cycles
Question: What is the Crankarm product's net profit?
Evidence: net profit = Subtract(LastReceiptCost, StandardPrice);
SQL: SELECT T2.LastReceiptCost - T2.StandardPrice FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE '%Crankarm%'
Database: works_cycles
Question: What is the name of the product with the almost highest review score?
Evidence: highest review score refers to Rating = 5;
SQL: SELECT T1.Name FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Rating = ( SELECT Rating FROM ProductReview ORDER BY Rating DESC LIMIT 1 )
Database: works_cycles
Question: What is the company's second highest salary per hour for employees who are paid monthly?
Evidence: salary received monthly refers to PayFrequency = 1; highest salary per hour refers to Max(Rate);
SQL: SELECT Rate FROM EmployeePayHistory WHERE PayFrequency = 1 ORDER BY Rate DESC LIMIT 1, 1
Database: works_cycles
Question: How many Vista cards expired before the year 2007?
Evidence: Vista Card refers to CardType = 'Vista'; expire before the year 2007 refers to ExpYear< = 2006;


SQL: SELECT COUNT(CreditCardID) FROM CreditCard WHERE CardType = 'Vista' AND ExpYear < 2007
Database: works_cycles
Question: What time does the company's night shift begin? Indicate the answer in regular form.
Evidence: Night shift refers to Name = 'Night';
SQL: SELECT StartTime FROM Shift WHERE Name = 'Night'
Database: works_cycles
Question: What is the weight in pounds of the style that is produced the most by the company? If there are multiple products sharing the same weight, indicate the name of each one of them and their corresponding weights.
Evidence: weight in pounds refers to WeightUnitMeasureCode = 'LB';
SQL: SELECT Weight FROM Product WHERE WeightUnitMeasureCode = 'LB' GROUP BY Weight ORDER BY COUNT(Style) DESC LIMIT 1
Database: works_cycles
Question: Which territory has the greatest difference in sales from previous year to this year? Indicate the difference, as well as the name and country of the region.
Evidence: greatest difference in sales from previous year to this year refers to Max(Subtract(SalesLastYear,SalesYTD));
SQL: SELECT SalesLastYear - SalesYTD, Name, CountryRegionCode FROM SalesTerritory ORDER BY SalesLastYear - SalesYTD DESC LIMIT 1
Database: works_cycles
Question: What are the names of the top 6 products that has the biggest size in centimeter and what are its reorder point?
Evidence: in centimeter refers to SizeUnitMeasureCode = 'CM';
SQL: SELECT Name, ReorderPoint FROM Product WHERE SizeUnitMeasureCode = 'CM' ORDER BY Size DESC LIMIT 6
Database: works_cycles
Question: How much is the amount to be paid by the company for the purchase order with the third highest freight amount?
Evidence: amount to be paid refers to TotalDue;
SQL: SELECT TotalDue FROM PurchaseOrderHeader ORDER BY Freight DESC LIMIT 2, 1
Database: works_cycles
Question: What profit will the company gain if they sell 10 items of the product that has the lightest weight?
Evidence: Lightest product refers to Min(Weight); profit if they sell 10 items refers to Subtract (ListPrice , StandardCost) *10;
SQL: SELECT 10 * (ListPrice - StandardCost) FROM Product WHERE Weight IS NOT NULL ORDER BY Weight LIMIT 1
Database: works_cycles
Question: How much is the tax amount of the purchase order with the biggest tax amount? Indicate the purchase order ID.
Evidence: tax amount refers to TaxAmt; biggest tax amount refers to MAX(TaxAmt);
SQL: SELECT TaxAmt, PurchaseOrderID FROM PurchaseOrderHeader ORDER BY TaxAmt DESC LIMIT 1
Database: works_cycles
Question: How many person have a projected yearly sales of no more than 50,000?
Evidence: projected yearly sales refers to SalesQuota; SalesQuota< = 50000;
SQL: SELECT COUNT(BusinessEntityID) FROM SalesPersonQuotaHistory WHERE SalesQuota < 500000