Chinastark/bird_dataset huggingface dataset:
Database: ice_hockey_draft
Question: Who is the tallest player in team USA U20?
Evidence: tallest refers to MAX(height_in_cm); 
player refers to PlayerName; team USA U20 refers to TEAM = 'USA U20';
SQL: SELECT T.PlayerName FROM ( SELECT T1.PlayerName, T3.height_in_cm FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID INNER JOIN height_info AS T3 ON T1.height = T3.height_id WHERE T2.TEAM = 'USA U20' ORDER BY T3.height_in_cm DESC ) AS T WHERE T.height_in_cm = ( SELECT MAX(T3.height_in_cm) FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID INNER JOIN height_info AS T3 ON T1.height = T3.height_id WHERE T2.TEAM = 'USA U20' )
Database: ice_hockey_draft
Question: What is the percentage of Swedish players in playoffs games in the 1997 - 2000 season?
Evidence: percentage = MULTIPLY(DIVIDE(SUM(nation = 'Sweden'), COUNT(ELITEID) WHERE SEASON = '1997-2000'), 100); Swedish refers to nation = 'Sweden'; players refers to PlayerName; playoffs games refers to GAMETYPE = 'Playoffs'; 1997-2000 season refers to 3 consecutive SEASONs : '1997-1998', '1998-1999', '1999-2000';
SQL: SELECT DISTINCT CAST(COUNT(CASE WHEN T1.nation = 'Sweden' THEN T1.ELITEID ELSE NULL END) OVER (PARTITION BY T2.SEASON) AS REAL) * 100 / COUNT(T1.ELITEID) OVER (PARTITION BY T2.SEASON) FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.SEASON IN ('1997-1998', '1998-1999', '1999-2000')
Database: ice_hockey_draft
Question: Calculate the percentage of penalty minutes of Swedish players in OHL league among all players.
Evidence: percentage = MULTIPLY(DIVIDE(SUM(PIM WHERE nation = 'Sweden'), COUNT(ELITEID) WHERE LEAGUE = 'OHL'), 100); Swedish refers to nation = 'Sweden'; players refers to PlayerName; OHL league refers to LEAGUE = 'OHL';
SQL: SELECT CAST(COUNT(CASE WHEN T1.nation = 'Sweden' THEN T2.PIM ELSE NULL END) AS REAL) * 100 / COUNT(*) FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.LEAGUE = 'OHL'
Database: works_cycles
Question: What is the average standard cost of product number CA-1098?
Evidence: Average cost = AVG(StandardCost)
SQL: SELECT AVG(T2.StandardCost) FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductNumber = 'CA-1098'
Database: works_cycles
Question: For all the products, list the product name and its corresponding start date for the current standard cost.
Evidence: The current standard cost refers to EndDate is NULL
SQL: SELECT T1.Name, T2.StartDate FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T2.EndDate IS NULL
Database: works_cycles
Question: List the products whereby the standard cost is $80 more than previous standard cost in history.
Evidence: SUBTRACT(product.StandardCost, CostHistory.StandardCost)>80
SQL: SELECT T1.Name FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.StandardCost - T2.StandardCost > 80 GROUP BY T1.Name
Database: works_cycles
Question: Name all products and total quantity for each item for shopping cart ID 14951.
SQL: SELECT T1.Name, T2.Quantity FROM Product AS T1 INNER JOIN ShoppingCartItem AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ShoppingCartID = 14951
Database: works_cycles
Question: List the product name with more than 5 quantity in the shopping cart.
Evidence: Product with more than 5 quantity refers to Quantity>5
SQL: SELECT T1.Name FROM Product AS T1 INNER JOIN ShoppingCartItem AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 5
Database: works_cycles
Question: For all the purchase order transactions, name all the products with low quality.
Evidence: Low quality refers to the product's quality class, therefore Class = 'L'
SQL: SELECT DISTINCT T1.Name FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Class = 'L' AND T2.TransactionType = 'P' ORDER BY T1.Name
Database: works_cycles
Question: Provide all the transactions whereby the quantiy is more than 10,000 pieces. State the product name and the selling price.
Evidence: Quantity more than 10,000 pieces refers to Quantity>10000; selling price refers to ListPrice
SQL: SELECT DISTINCT T1.Name, T1.ListPrice FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 10000
Database: works_cycles
Question: Which is a high quality product but with the lowest transacted quantity?
Evidence: High quality refers to the product's quality class, therefore Class = 'H'; the lowest transacted quantity refers to Quantity = 1
SQL: SELECT T1.Name FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Class = 'H' ORDER BY T2.Quantity ASC LIMIT 1
Database: works_cycles
Question: How many transactions are there for product under the Mountain line?
Evidence: The Mountain line refers to the product line, therefore ProductLine = 'M'
SQL: SELECT COUNT(T2.TransactionID) FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductLine = 'M'
Database: works_cycles
Question: How much would be the total sales profit for shopping cart ID 20621 ?
Evidence: Sales profit = MULTIPLY(SUBTRACT(ListPrice, StandardCost; Quantity)), where ShoppingCartID = '20621'
SQL: SELECT SUM((T1.ListPrice - T1.StandardCost) * T2.Quantity) FROM Product AS T1 INNER JOIN ShoppingCartItem AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ShoppingCartID = 20621
Database: works_cycles
Question: List all product names that are high in quality. Please also state its selling price.
Evidence: High quality refers to the product's quality class, therefore Class = 'H'
SQL: SELECT Name, ListPrice FROM Product WHERE Class = 'H'
Database: works_cycles
Question: Which product line has the most products that are salable?
Evidence: Saleable product refers to FinishedGoodsFlag = 1
SQL: SELECT ProductLine FROM Product WHERE FinishedGoodsFlag = 1 GROUP BY ProductLine ORDER BY COUNT(FinishedGoodsFlag) DESC LIMIT 1
Database: works_cycles
Question: Provide details of review from reviewer whose name begin with letter 'J'. State the product ID, rating and comments.
Evidence: reviewer whose name begin with letter 'J' = ReviewerName LIKE 'J%'
SQL: SELECT ProductID, Rating, Comments FROM ProductReview WHERE ReviewerName LIKE 'J%'
Database: works_cycles
Question: State the product name, product line, rating and the selling price of product with the lowest rating.
Evidence: Product with the lowest rating refers to the rating
given by the
reviewer where Rating = 1
SQL: SELECT T1.Name, T1.ProductLine, T2.Rating, T1.ListPrice FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID ORDER BY T2.Rating ASC LIMIT 1
Database: works_cycles
Question: Calculate the profit of each products. List all products with more than $100 in profit.
Evidence: Profit = AVG(SUBTRACT(ListPrice, StandardCost)>100
SQL: SELECT DISTINCT Name FROM Product WHERE ListPrice - StandardCost > 100
Database: works_cycles
Question: List down the product name, reviewer name, rating and comments for product under the road line.
Evidence: The Road line refers to the product line, therefore ProductLine = 'R'
SQL: SELECT T1.Name, T2.ReviewerName, T2.Rating, T2.Comments FROM Product AS T1 INNER JOIN ProductReview AS T2 USING (productID) WHERE T1.ProductLine = 'R'
Database: works_cycles
Question: How many people reviewed for product named HL Mountain Pedal? What is the average rating?
Evidence: AVG(Rating) = DIVIDE(SUM(rating), COUNT(ReviewerName))
SQL: SELECT COUNT(T1.ProductID), AVG(T2.Rating) FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'HL Mountain Pedal'
Database: works_cycles
Question: List the purchase order whereby all received quantity were rejected? Name those product.
Evidence: Rejected refers rejected product in which to RejectedQty = 1
SQL: SELECT T1.Name FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.RejectedQty = T2.ReceivedQty AND T2.RejectedQty <> 0
Database: works_cycles
Question: Among all products without any rejected quantity, which product has the highest line total? State the product name and unit price.
Evidence: Product without any rejected quantity refers to RejectedQty = 0
SQL: SELECT T1.Name, T2.UnitPrice FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.RejectedQty = 0 ORDER BY T2.LineTotal DESC LIMIT 1
Database: works_cycles
Question: List all product names and its product line for all purchase order with order quantity of 5000 or more.
Evidence: Purchase order with order quantity of 5000 or more refers to OrderQty> = 5000
SQL: SELECT T1.Name, T1.ProductLine FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderQty > 4999
Database: works_cycles
Question: What is the total ordered quantity for products under the 'Touring' line?
Evidence: The Touring line refers to the product line, therefore ProductLine = 'T'
SQL: SELECT SUM(T2.OrderQty) FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductLine = 'T'
Database: works_cycles
Question: Among the low quality product, which product has the highest line total? List the product name and its line total?
Evidence: Low quality refers to the product's quality class, therefore Class = 'L'
SQL: SELECT T1.Name, T2.LineTotal FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE Class = 'L' ORDER BY OrderQty * UnitPrice DESC LIMIT 1
Database: works_cycles
Question: Which product has the highest profit on net? State the product name.
Evidence: Profit on net = SUBTRACT(LastReceiptCost, StandardPrice)
SQL: SELECT T1.Name FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID ORDER BY T2.LastReceiptCost - T2.StandardPrice DESC LIMIT 1
Database: works_cycles
Question: List all products with minimum order quantity of 100 and order them by product name in descending order.
Evidence: miinimum order quantity refers to MinOrderQty = 100
SQL: SELECT DISTINCT T1.Name FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MinOrderQty = 100 ORDER BY T1.Name DESC
Database: works_cycles
Question: List the name and calculate its profit for product with the highest rating in review.
Evidence: Profit = SUBTRACT(ListPrice, StandardCost); the highest rating in review refers to Rating = 5
SQL: SELECT T1.Name, T1.ListPrice - T1.StandardCost FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID ORDER BY T2.Rating DESC LIMIT 1
Database: works_cycles
Question: What is the total profit all transactions with product ID 827?
Evidence: Profit = MULTIPLY(SUBTRACT(ListPrice, StandardCost) Quantity))
SQL: SELECT SUM((T1.ListPrice - T1.StandardCost) * T2.Quantity) FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 827
Database: works_cycles
Question: Which currency pair's average exchange rate for the day is the highest?
Evidence: currency pair refers to FromCurrencyCode/ToCurrencyCode
SQL: SELECT FromCurrencyCode, ToCurrencyCode FROM CurrencyRate ORDER BY AverageRate DESC LIMIT 1
Database: works_cycles
Question: How many products with the highest unit price were ordered?
Evidence: number of products refers to OrderQty
SQL: SELECT OrderQty FROM PurchaseOrderDetail ORDER BY UnitPrice DESC LIMIT 1
Database: works_cycles
Question: Between Northwest and Southeast of the United States, which territory one recorded the highest amount of sales last year?
Evidence: United States refers to CountryRegionCode = 'US';
SQL: SELECT Name FROM SalesTerritory WHERE CountryRegionCode = 'US' AND (Name = 'Northwest' OR Name = 'Southeast') ORDER BY SalesLastYear DESC LIMIT 1
Database: works_cycles
Question: What is the full name of the Document Control Manager who is in charge of all Level 1 approved documents?
Evidence: full Name = FirstName+MiddleName+Last Name; approved document refers to Status = 2;
SQL: SELECT T1.FirstName, T1.MiddleName, T1.LastName FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Document AS T3 ON T3.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Manager' AND T3.DocumentLevel = 1 AND T3.Status = 2 GROUP BY T1.FirstName, T1.MiddleName, T1.LastName
Database: works_cycles
Question: Which customer has the highest subtotal amount of sales orders whose assigned to the salesperson with the highest bonus?
Evidence: highest subtotal amount of sales order refers to max(SubTotal);
SQL: SELECT T1.CustomerID FROM SalesOrderHeader AS T1 INNER JOIN SalesPerson AS T2 ON T1.SalesPersonID = T2.BusinessEntityID ORDER BY T1.SubTotal DESC LIMIT 1
Database: works_cycles
Question: What is the total price of Sales Order ID 46625 with Volume Discount 11 to 14 and Product ID 716?
Evidence: total price = multiply(UnitPrice, OrderQty);
SQL: SELECT T2.UnitPrice * T2.OrderQty FROM SpecialOffer AS T1 INNER JOIN SalesOrderDetail AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID WHERE T1.Description = 'Volume Discount 11 to 14' AND T1.SpecialOfferID = 2 AND T2.ProductID = 716 AND T2.SalesOrderID = 46625
Database: works_cycles
Question: Of the products that has a reorder inventory point of no more than 600, how many manufactured in-house products that takes 1 day to manufacture with BOM Level 4 are there?
Evidence: ReorderPoint<600; product is manufactured in-house refers to Makeflag = 1;
SQL: SELECT COUNT(T1.ProductID) FROM Product AS T1 INNER JOIN BillOfMaterials AS T2 ON T1.ProductID = T2.ProductAssemblyID WHERE T1.MakeFlag = 1 AND T1.DaysToManufacture = 1 AND T2.BOMLevel = 4 AND T1.ReorderPoint <= 600
Database: works_cycles
Question: What is the highest amount of bonus earned by the sales person in Canada?
Evidence: Canada is name of a sales territory
SQL: SELECT T2.Bonus FROM SalesTerritory AS T1 INNER JOIN SalesPerson AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.CountryRegionCode = 'CA' ORDER BY T2.SalesQuota DESC LIMIT 1
Database: works_cycles
Question: What are the names of the product that has the lowest rating?
Evidence: lowest rating refers to Rating = 1;
SQL: SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Rating = ( SELECT Rating FROM ProductReview ORDER BY Rating ASC LIMIT 1 )
Database: works_cycles
Question: How many of the workers who started working in 2009 are from the Production Department?
Evidence: StartDate BETWEEN '2009-01-01' AND '2009-12-31';
SQL: SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID WHERE T2.StartDate >= '2009-01-01' AND T2.StartDate < '2010-01-01' AND T1.Name = 'Production'
Database: works_cycles
Question: Who is the company's highest-paid single female employee? Include her full name and job title.
Evidence: full name = FirstName+MiddleName+LastName; highest-paid refers to max(Rate); single refers to Status = 'S'; female refers to Gender = 'F';
SQL: SELECT T3.FirstName, T3.MiddleName, T3.LastName, T1.JobTitle FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Person AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.MaritalStatus = 'S' AND T1.Gender = 'F' ORDER BY T2.Rate DESC LIMIT 1
Database: works_cycles
Question: Who is the Vice President of Engineering and when did he join the company? Indicate his/her full name.
Evidence: full name = FirstName+MiddleName+LastName; HiredDate refers to the date the person joins the company;
SQL: SELECT T2.FirstName, T2.MiddleName, T2.LastName, T1.HireDate FROM Employee AS T1 INNER JOIN Person AS T2 USING (BusinessEntityID) WHERE T1.JobTitle = 'Vice President of Engineering'
Database: works_cycles
Question: How many active employees whose payrate is equal or below 30 per hour.
Evidence: active employee refers to CurrentFlag = 1; Rate< = 30;
SQL: SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.CurrentFlag = 1 AND T2.Rate <= 30
Database: works_cycles
Question: Which department has a worker who just recently started working?
Evidence: recently started working refers to latest StartDate;
SQL: SELECT T1.Name FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID ORDER BY T2.StartDate DESC LIMIT 1
Database: works_cycles
Question: Which store sales person was reently hired? Indicate his/her full name and gender.
Evidence: SC is an abbreviation for Store Contact; store contact person refers to PersonType = 'SC'; recently hired refers to latest StartDate;
SQL: SELECT T2.FirstName, T2.MiddleName, T2.LastName, T1.Gender FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP'
Database: works_cycles
Question: How frequently do the employee with the least number of sick leave hours get paid?
Evidence: least number of sick leave refers to min(SickLeaveHours); PayFrequency = 1 means ‘Salary received monthly’; PayFrequency = 2 means ‘Salary received biweekly';
SQL: SELECT T2.PayFrequency FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.SickLeaveHours ASC LIMIT 1
Database: works_cycles
Question: Which job title has the lowest pay?
Evidence: lowest pay refers to min(Rate);
SQL: SELECT T1.JobTitle FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.Rate ASC LIMIT 1
Database: works_cycles
Question: What is the total number of employees that worked in the Finance department?
SQL: SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 USING (DepartmentID) WHERE T1.Name = 'Finance'
Database: works_cycles
Question: What is the profit of the product with the highest list price and of the product with the lowest list price other than 0? Indicates the depth the component is from its parent.
Evidence: profit = subtract(ListPrice, StandardCost); the depth the component from its parent refers to BOMLevel;
SQL: SELECT ( SELECT ListPrice - StandardCost FROM Product WHERE ListPrice != 0 ORDER BY ListPrice DESC LIMIT 1 ) , ( SELECT ListPrice - StandardCost FROM Product WHERE ListPrice != 0 ORDER BY ListPrice LIMIT 1 )
Database: works_cycles
Question: Among the companies to which Adventure Works Cycles purchases parts or other goods, what is the profit on net obtained from the vendor who has an above average credit rating? Kindly indicate each names of the vendor and the corresponding net profits.
Evidence: above average credit rating refers to CreditRating = 3; profit on net = subtract(LastReceiptCost, StandardPrice);
SQL: SELECT T2.Name, T1.LastReceiptCost - T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CreditRating = 3
Database: works_cycles
Question: How many accounts have an address that is too long?
Evidence: address that is too long refers to AddressLine2! = null
SQL: SELECT COUNT(*) FROM Address WHERE AddressLine2 <> ''
Database: works_cycles
Question: What is the postal code of the street address of the account that is latest updated?
Evidence: account latest updated refers to year(ModifiedDate) = 2022 and month(ModifiedDate) = 10
SQL: SELECT PostalCode FROM Address ORDER BY ModifiedDate DESC LIMIT 1
Database: works_cycles
Question: What is the longest assembly item duration for bicycles?
Evidence: longest assembly item duration = max(subtract(EndDate,StartDate))
SQL: SELECT JULIANDAY(EndDate) - JULIANDAY(StartDate) FROM BillOfMaterials ORDER BY JULIANDAY(EndDate) - JULIANDAY(StartDate) DESC LIMIT 1
Database: works_cycles
Question: How many assembly items for bicycles aren't finished?
Evidence: assembly lines that are not finished refers to EndDate = null
SQL: SELECT COUNT(BillOfMaterialsID) FROM BillOfMaterials WHERE EndDate IS NULL
Database: works_cycles
Question: Please list the unit measure code of the component that is of the greatest need in quantity to create the assembly.
Evidence: greatest need in quantity refers to max(PerAssemblyQty)
SQL: SELECT UnitMeasureCode FROM BillOfMaterials ORDER BY PerAssemblyQty DESC LIMIT 1
Database: works_cycles
Question: How many product maintenance documents are private?
Evidence: product maintenance documents are private refers to DocumentSummary = null
SQL: SELECT COUNT(DocumentNode) FROM Document WHERE DocumentSummary IS NULL
Database: works_cycles
Question: Please list the titles of the documents that are pending approval.
Evidence: documents pending approval refers to Status = 1
SQL: SELECT Title FROM Document WHERE Status = 1
Database: works_cycles
Question: Please list the job titles of the employees who has a document that has been approved.
Evidence: document has been approved refers to Status = 2
SQL: SELECT DISTINCT T2.BusinessEntityID, T2.JobTitle FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T1.Status = 2
Database: works_cycles
Question: What is the pay frequency of the oldest employee?
Evidence: oldest employee refers to min(BirthDate); PayFrequency = 1 refers to ‘Salary received monthly’; PayFrequency = 2 refers to ‘Salary received biweekly'
SQL: SELECT T1.PayFrequency FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.BirthDate ASC LIMIT 1
Database: works_cycles
Question: Among the employees whose pay frequencies are the highest, how many of them are married?
Evidence: married refers to MaritalStatus = M; highest pay frequency refers to PayFrequency = 2
SQL: SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.MaritalStatus = 'M' AND T1.PayFrequency = ( SELECT PayFrequency FROM EmployeePayHistory ORDER BY PayFrequency DESC LIMIT 1 )
Database: works_cycles
Question: For the employee who has been hired the latest, what is his or her pay rate?
Evidence: hired the latest refers to max(HireDate)
SQL: SELECT T1.Rate FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.HireDate DESC LIMIT 1
Database: works_cycles
Question: Among the employees who have a pay rate of above 40, how many of them are male?
Evidence: pay rate above 40 refers to Rate>40; male employee refers to Gender = M
SQL: SELECT SUM(CASE WHEN T2.Gender = 'M' THEN 1 ELSE 0 END) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Rate > 40
Database: works_cycles
Question: What is the highest pay rate of the employees who are exempt from collective bargaining?
Evidence: employee exempt from collective bargaining refers to SalariedFlag = 1; highest pay rate refers to max(Rate)
SQL: SELECT T1.Rate FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.SalariedFlag = 1 ORDER BY T1.Rate DESC LIMIT 1
Database: works_cycles
Question: For the employees who have the highest pay frequency, please list their vacation hours.
Evidence: highest pay frequency refers to PayFrequency = 2
SQL: SELECT T2.VacationHours FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.BusinessEntityID = ( SELECT BusinessEntityID FROM EmployeePayHistory ORDER BY Rate DESC LIMIT 1 )
Database: works_cycles
Question: What is the pay rate of the employee who has the longest vacation hours?
Evidence: longest vacation hour refers to max(VacationHours)
SQL: SELECT T1.Rate FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.VacationHours DESC LIMIT 1
Database: works_cycles
Question: How many employees with a pay rate of over 35 have more than 10 sick leave hours?
Evidence: more than 10 sick leave hours refers to SickLeaveHours>10; pay rate over 35 refers to Rate>35;
SQL: SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.SickLeaveHours > 10 AND T1.Rate > 35