set
dict |
---|
{
"query": "How many of the approved documents are confidential?",
"pos": [
"SELECT COUNT(DocumentNode) FROM Document WHERE Status = 2 AND DocumentSummary IS NULL"
],
"neg": [
"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",
"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",
"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",
"SELECT DISTINCT T1.Name, T1.ListPrice FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 10000",
"SELECT SUM(CASE WHEN T2.ProductLine = 'M' THEN 1 ELSE 0 END) FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.FinishedGoodsFlag = 1 GROUP BY T1.ProductID ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1",
"SELECT COUNT(T1.TransactionID) FROM TransactionHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Quantity BETWEEN 100 AND 250 AND T2.ReorderPoint <= 375",
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 1 GROUP BY T2.Name ORDER BY SUM(T1.Rating) DESC LIMIT 1",
"SELECT TaxAmt, PurchaseOrderID FROM PurchaseOrderHeader ORDER BY TaxAmt DESC LIMIT 1",
"SELECT TransactionID FROM TransactionHistory WHERE TransactionType = 'W' ORDER BY Quantity DESC LIMIT 1",
"SELECT COUNT(*) FROM BillOfMaterials WHERE BOMLevel = 2 AND EndDate IS NULL"
]
} |
{
"query": "What is the full address of business number 24?",
"pos": [
"SELECT T1.AddressLine1, T1.AddressLine2 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T2.BusinessEntityID = 24"
],
"neg": [
"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",
"SELECT DISTINCT ProductID FROM ProductVendor WHERE StandardPrice - LastReceiptCost < 0",
"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",
"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",
"SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.CurrentFlag = 1 AND T2.Title = 'Mr.'",
"SELECT SUM(T1.StandardPrice) / COUNT(T1.BusinessEntityID) FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Hex Nut 5'",
"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",
"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'",
"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",
"SELECT T2.CustomerID FROM SalesOrderDetail AS T1 INNER JOIN Customer AS T2 WHERE T1.UnitPrice = 35 AND T1.OrderQty = 32"
]
} |
{
"query": "For all the employees that have left the Engineering Department, what is the average time of their stay?",
"pos": [
"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"
],
"neg": [
"SELECT T3.PurchasingWebServiceURL 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 T2.Name = 'Hex Nut 5'",
"SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277",
"SELECT COUNT(T2.CustomerID) FROM SalesTerritory AS T1 INNER JOIN Customer AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.Name = 'Canada'",
"SELECT Description, DiscountPct FROM SpecialOffer WHERE Category = 'Reseller' ORDER BY DiscountPct DESC LIMIT 0, 3",
"SELECT T1.Bonus FROM SalesPerson AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.FirstName = 'Rachel' AND T2.LastName = 'Valdez'",
"SELECT COUNT(DocumentNode) FROM Document WHERE DocumentSummary IS NULL",
"SELECT T1.ProductID FROM ProductListPriceHistory AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID ORDER BY T1.ListPrice - T2.StandardCost DESC LIMIT 1",
"SELECT COUNT(BillOfMaterialsID) FROM BillOfMaterials WHERE EndDate IS NULL",
"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%' )",
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1"
]
} |
{
"query": "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?",
"pos": [
"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"
],
"neg": [
"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'",
"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'",
"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'",
"SELECT T1.Rating FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ReviewerName = 'Jill' AND T2.Name = 'HL Mountain Pedal'",
"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'",
"SELECT ProductID FROM Product WHERE ProductID NOT IN ( SELECT T1.ProductID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID )",
"SELECT CAST(SUM(CASE WHEN JobTitle = 'Sales Representative' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(BusinessEntityID) FROM Employee",
"SELECT TaxAmt, PurchaseOrderID FROM PurchaseOrderHeader ORDER BY TaxAmt DESC LIMIT 1",
"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'",
"SELECT T1.ListPrice - T2.StandardCost FROM ProductListPriceHistory AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 792"
]
} |
{
"query": "How many customers are there in Canada?",
"pos": [
"SELECT COUNT(T2.CustomerID) FROM SalesTerritory AS T1 INNER JOIN Customer AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.Name = 'Canada'"
],
"neg": [
"SELECT SUM(T1.StandardPrice) / COUNT(T1.BusinessEntityID) FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Hex Nut 5'",
"SELECT T2.Suffix FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP' ORDER BY T1.SickLeaveHours DESC LIMIT 1",
"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",
"SELECT COUNT(BillOfMaterialsID) FROM BillOfMaterials WHERE EndDate IS NULL",
"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'",
"SELECT AVG(T2.Rate) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID GROUP BY T1.Gender",
"SELECT TerritoryID FROM Customer WHERE ModifiedDate < '2014-12-09' GROUP BY TerritoryID ORDER BY COUNT(TerritoryID) DESC LIMIT 1",
"SELECT T1.TransactionType FROM TransactionHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Road Frame - Black, 48' AND STRFTIME('%Y-%m-%d',T1.TransactionDate) = '2013-07-31'",
"SELECT SafetyStockLevel FROM Product WHERE Name = 'Chainring Bolts'",
"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'"
]
} |
{
"query": "What is the Crankarm product's net profit?",
"pos": [
"SELECT T2.LastReceiptCost - T2.StandardPrice FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE '%Crankarm%'"
],
"neg": [
"SELECT T2.Shelf FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'",
"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'",
"SELECT SUM(CASE WHEN T2.ProductLine = 'M' THEN 1 ELSE 0 END) FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.FinishedGoodsFlag = 1 GROUP BY T1.ProductID ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1",
"SELECT COUNT(LocationID) FROM WorkOrderRouting WHERE ActualResourceHrs = 2",
"SELECT SUM(CASE WHEN T1.ProductLine = 'M' THEN 1 ELSE 0 END) FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID GROUP BY T1.ProductID HAVING COUNT(T1.Name) > 2",
"SELECT ReviewerName FROM ProductReview WHERE Rating = ( SELECT Rating FROM ProductReview ORDER BY Rating DESC LIMIT 1 )",
"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 T1.Gender = 'M' AND T2.PersonType = 'EM'",
"SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SP'",
"SELECT T1.ProductID FROM ProductListPriceHistory AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID ORDER BY T1.ListPrice - T2.StandardCost DESC LIMIT 1",
"SELECT CardNumber FROM CreditCard WHERE ExpYear < 2007"
]
} |
{
"query": "Which type of transaction was it for the \"LL Road Handlebars\" order happened in 2012/11/3?",
"pos": [
"SELECT T1.TransactionType FROM TransactionHistoryArchive AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'LL Road Handlebars' AND STRFTIME('%Y-%m-%d',T1.TransactionDate) = '2012-11-03'"
],
"neg": [
"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'",
"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'",
"SELECT T3.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 T2.Name = 'Hex Nut 5' ORDER BY T1.StandardPrice LIMIT 1",
"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'",
"SELECT T2.BusinessEntityID, STRFTIME('%Y', T2.HireDate) - STRFTIME('%Y', T2.BirthDate) FROM PurchaseOrderHeader AS T1 INNER JOIN Employee AS T2 ON T1.EmployeeID = T2.BusinessEntityID ORDER BY T1.TotalDue DESC LIMIT 1",
"SELECT T2.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'LL Fork'",
"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'",
"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 )",
"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",
"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'"
]
} |
{
"query": "Identifies the ID number of the customer whose sales order for 32 units had a unit price of 35.",
"pos": [
"SELECT T2.CustomerID FROM SalesOrderDetail AS T1 INNER JOIN Customer AS T2 WHERE T1.UnitPrice = 35 AND T1.OrderQty = 32"
],
"neg": [
"SELECT BusinessEntityID FROM Person WHERE Title = 'Mr.' AND FirstName = 'Hung-Fu' AND LastName = 'Ting'",
"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'",
"SELECT SUM(CASE WHEN T2.ProductLine = 'M' THEN 1 ELSE 0 END) FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID HAVING COUNT(T1.ProductReviewID) > 1",
"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",
"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'",
"SELECT T2.PhoneNumber FROM Person AS T1 INNER JOIN PersonPhone AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SC'",
"SELECT COUNT(CardNumber) FROM CreditCard WHERE CardType = 'vista'",
"SELECT T1.Description FROM ProductDescription AS T1 INNER JOIN Product AS T2 WHERE T2.Name = 'Headset Ball Bearings' AND T1.productDescriptionID = T2.ProductID",
"SELECT T2.City, T1.Name, T1.IsOnlyStateProvinceFlag FROM StateProvince AS T1 INNER JOIN Address AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.AddressID = 15873",
"SELECT T2.PersonType FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.BirthDate ASC LIMIT 1"
]
} |
{
"query": "How many employees work for AdvertureWorks that is single?",
"pos": [
"SELECT COUNT(T1.BusinessentityID) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'EM' AND T2.MaritalStatus = 'S'"
],
"neg": [
"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'",
"SELECT CAST(COUNT(IIF(T1.PersonType = 'SC', T1.PersonType, NULL)) AS REAL) / COUNT(T1.PersonType) FROM Person AS T1 INNER JOIN Employee AS T2 WHERE T1.PersonType = 'SC' AND T1.NameStyle = 0 AND T2.MaritalStatus = 'M'",
"SELECT JobTitle FROM Employee ORDER BY SickLeaveHours DESC LIMIT 3",
"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'",
"SELECT COUNT(DocumentNode) FROM Document WHERE DocumentSummary IS NULL",
"SELECT SalesYTD - SalesQuota FROM SalesPerson WHERE BusinessEntityID = 288",
"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",
"SELECT T2.Suffix FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP' ORDER BY T1.SickLeaveHours DESC LIMIT 1",
"SELECT JobTitle FROM Employee WHERE STRFTIME('%Y', HireDate) = '2007' GROUP BY HireDate ORDER BY COUNT(JobTitle) DESC LIMIT 1",
"SELECT SUM(T1.PerAssemblyQty), T2.Name FROM BillOfMaterials AS T1 INNER JOIN UnitMeasure AS T2 ON T1.UnitMeasureCode = T2.UnitMeasureCode WHERE T1.UnitMeasureCode IN ('EA', 'IN', 'OZ') GROUP BY T2.Name"
]
} |
{
"query": "List the locations ids, compartments and containers for the Lock Ring",
"pos": [
"SELECT T2.LocationID, T2.Shelf, T2.Bin FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE 'Lock Ring'"
],
"neg": [
"SELECT ReviewerName FROM ProductReview WHERE Rating = ( SELECT Rating FROM ProductReview ORDER BY Rating DESC LIMIT 1 )",
"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'",
"SELECT T1.FirstName, T2.BirthDate FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.BusinessEntityID = 18",
"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'",
"SELECT T1.AddressLine1, T1.AddressLine2 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T2.BusinessEntityID = 24",
"SELECT SUM(FinishedGoodsFlag) FROM Product WHERE MakeFlag = 1",
"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",
"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'",
"SELECT SUM(Quantity) FROM TransactionHistory WHERE TransactionDate LIKE '2013-08%' AND TransactionType = 'S' AND ProductID = 989",
"SELECT AVG(T2.Rate) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID GROUP BY T1.Gender"
]
} |
{
"query": "How many products from the Clothing category were on the LL Road Frame Sale?",
"pos": [
"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'"
],
"neg": [
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 USING (ProductID) WHERE T2.FinishedGoodsFlag = 1 AND T2.MakeFlag = 1 GROUP BY T2.Name ORDER BY COUNT(T1.COMMENTS) > 10",
"SELECT BusinessEntityID FROM Vendor WHERE CreditRating = ( SELECT CreditRating FROM Vendor ORDER BY CreditRating DESC LIMIT 1 )",
"SELECT SUM(CASE WHEN T1.ProductLine = 'M' THEN 1 ELSE 0 END) FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID GROUP BY T1.ProductID HAVING COUNT(T1.Name) > 2",
"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",
"SELECT COUNT(DISTINCT T1.Name) FROM SalesTaxRate AS T1 INNER JOIN StateProvince AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.Name = 'Quebec'",
"SELECT COUNT(DISTINCT T2.ProductID) FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName = 'roadster_black_large.gif'",
"SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Mountain Pedal' ORDER BY T1.Rating LIMIT 1",
"SELECT T2.FirstName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.MaritalStatus = 'S' AND T1.Gender = 'M' AND T1.JobTitle LIKE 'Production Supervisor%'",
"SELECT JobTitle FROM Employee WHERE STRFTIME('%Y', HireDate) = '2007' GROUP BY HireDate ORDER BY COUNT(JobTitle) DESC LIMIT 1",
"SELECT T1.Description FROM ProductDescription AS T1 INNER JOIN Product AS T2 WHERE T2.Name = 'Headset Ball Bearings' AND T1.productDescriptionID = T2.ProductID"
]
} |
{
"query": "What is the total sick leave hours of employees who do not wish to receive any e-mail promotion?",
"pos": [
"SELECT SUM(T1.SickLeaveHours) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 0"
],
"neg": [
"SELECT Name, ListPrice FROM Product WHERE Class = 'H'",
"SELECT T2.Suffix FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP' ORDER BY T1.SickLeaveHours DESC LIMIT 1",
"SELECT BusinessEntityID FROM Vendor WHERE CreditRating = ( SELECT CreditRating FROM Vendor ORDER BY CreditRating DESC LIMIT 1 )",
"SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'H'",
"SELECT 365 * (STRFTIME('%Y', ActualEndDate) - STRFTIME('%Y', ActualStartDate)) + 30 * (STRFTIME('%m', ActualEndDate) - STRFTIME('%m', ActualStartDate)) + STRFTIME('%d', ActualEndDate) - STRFTIME('%d', ActualStartDate) FROM WorkOrderRouting WHERE WorkOrderID = 425",
"SELECT T2.StandardCost, T2.ProductNumber FROM ProductCostHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 888",
"SELECT COUNT(BusinessEntityID) FROM Person WHERE PersonType = 'SC' AND Title = 'Mr.'",
"SELECT ReviewerName FROM ProductReview WHERE Rating = ( SELECT Rating FROM ProductReview ORDER BY Rating DESC LIMIT 1 )",
"SELECT CAST(SUM(CASE WHEN T2.Gender = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessentityID) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessentityID = T2.BusinessentityID WHERE T1.PersonType = 'EM'",
"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"
]
} |
{
"query": "List all the pay rates of all employees that were hired at 20 years of age.",
"pos": [
"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"
],
"neg": [
"SELECT T2.WorkOrderID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'",
"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'",
"SELECT T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Hex Nut 5' GROUP BY T1.StandardPrice ORDER BY COUNT(T1.StandardPrice) DESC LIMIT 1",
"SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.MaxOrderQty BETWEEN 500 AND 750 ORDER BY T1.LastReceiptCost - T1.StandardPrice DESC LIMIT 9, 1",
"SELECT SUM(Quantity) FROM TransactionHistory WHERE TransactionDate LIKE '2013-08%' AND TransactionType = 'S' AND ProductID = 989",
"SELECT T2.PayFrequency FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.SickLeaveHours ASC LIMIT 1",
"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'",
"SELECT Type FROM SpecialOffer WHERE Category = 'Reseller'",
"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",
"SELECT T2.Class FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T2.Class ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1"
]
} |
{
"query": "What is the order reference number for the \"Mountain End Caps\" product?",
"pos": [
"SELECT T2.ReferenceOrderID FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Mountain End Caps'"
],
"neg": [
"SELECT T1.UnitPrice, T3.Name FROM PurchaseOrderDetail AS T1 INNER JOIN PurchaseOrderHeader AS T2 ON T1.PurchaseOrderID = T2.PurchaseOrderID INNER JOIN Vendor AS T3 ON T2.VendorID = T3.BusinessEntityID ORDER BY T1.UnitPrice LIMIT 1",
"SELECT ListPrice - StandardCost FROM Product WHERE ProductID = 740",
"SELECT ProductID FROM Product WHERE ProductID NOT IN ( SELECT T1.ProductID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID )",
"SELECT CAST(SUM(CASE WHEN T1.DocumentSummary IS NOT NULL THEN 1 ELSE 0 END) AS REAL) / COUNT(T1.DocumentSummary) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.HireDate = '2009-01-22'",
"SELECT TaxAmt, PurchaseOrderID FROM PurchaseOrderHeader ORDER BY TaxAmt DESC LIMIT 1",
"SELECT COUNT(T2.ProductID) FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.OnOrderQty IS NULL OR T1.OnOrderQty = 0",
"SELECT T1.FirstName, T1.LastName FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T2.HireDate) >= '2007' AND T2.SalariedFlag = 1",
"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'",
"SELECT CardNumber FROM CreditCard WHERE ExpYear < 2007",
"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'"
]
} |
{
"query": "To which group does the department with the least amount of workers belong to? Indicate the name of the department as well.",
"pos": [
"SELECT T2.GroupName FROM EmployeeDepartmentHistory AS T1 INNER JOIN Department AS T2 ON T1.DepartmentID = T2.DepartmentID GROUP BY T2.GroupName ORDER BY COUNT(T1.BusinessEntityID) LIMIT 1"
],
"neg": [
"SELECT COUNT(T1.LocationID) FROM Location AS T1 INNER JOIN ProductInventory AS T2 USING (LocationID) WHERE T1.Name = 'Subassembly'",
"SELECT SUM(T1.StandardPrice) / COUNT(T1.BusinessEntityID) FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Hex Nut 5'",
"SELECT SalesYTD - SalesQuota FROM SalesPerson WHERE BusinessEntityID = 288",
"SELECT DISTINCT T1.Name, T1.ListPrice FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 10000",
"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'",
"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'",
"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",
"SELECT T1.LastReceiptCost - T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Freewheel'",
"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",
"SELECT T2.Suffix FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP' ORDER BY T1.SickLeaveHours DESC LIMIT 1"
]
} |
{
"query": "Calculate the total quantity of purchased product that has been prepared by employee number 257 and is in pending shipment status.",
"pos": [
"SELECT SUM(T2.OrderQty) FROM PurchaseOrderHeader AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.PurchaseOrderID = T2.PurchaseOrderID WHERE T1.Status = 1"
],
"neg": [
"SELECT FirstName, MiddleName, LastName FROM Person WHERE BusinessEntityID = 1 AND PersonType = 'EM'",
"SELECT T2.ProductID FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName LIKE '%large.gif'",
"SELECT T3.PurchasingWebServiceURL 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 T2.Name = 'Hex Nut 5'",
"SELECT StartTime FROM Shift WHERE Name = 'Night'",
"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",
"SELECT T1.Name, T1.ProductLine FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderQty > 4999",
"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",
"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'",
"SELECT OrderQty FROM PurchaseOrderDetail ORDER BY UnitPrice DESC LIMIT 1",
"SELECT T1.ListPrice - T2.StandardCost FROM ProductListPriceHistory AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 792"
]
} |
{
"query": "Among the employees in the Manufacturing group in 2007, how many of them are store contacts?",
"pos": [
"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'"
],
"neg": [
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 USING (ProductID) WHERE T2.FinishedGoodsFlag = 1 AND T2.MakeFlag = 1 GROUP BY T2.Name ORDER BY COUNT(T1.COMMENTS) > 10",
"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 )",
"SELECT T2.Name FROM SalesOrderHeaderSalesReason AS T1 INNER JOIN SalesReason AS T2 ON T1.SalesReasonID = T2.SalesReasonID WHERE T1.SalesOrderID = 43718",
"SELECT COUNT(BusinessEntityID) FROM Employee WHERE MaritalStatus = 'M' AND STRFTIME('%Y', BirthDate) < '1960' AND Gender = 'M'",
"SELECT COUNT(DISTINCT T1.ProductID) FROM SalesOrderDetail AS T1 INNER JOIN SpecialOfferProduct AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID INNER JOIN SpecialOffer AS T3 ON T2.SpecialOfferID = T3.SpecialOfferID WHERE T1.OrderQty > 2 AND T1.UnitPriceDiscount = 0",
"SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277",
"SELECT SUM(CASE WHEN T2.ProductLine = 'M' THEN 1 ELSE 0 END) FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.FinishedGoodsFlag = 1 GROUP BY T1.ProductID ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1",
"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",
"SELECT COUNT(T1.TransactionID) FROM TransactionHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Quantity BETWEEN 100 AND 250 AND T2.ReorderPoint <= 375",
"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'"
]
} |
{
"query": "What is the bussiness id for Mr. Hung-Fu Ting?",
"pos": [
"SELECT BusinessEntityID FROM Person WHERE Title = 'Mr.' AND FirstName = 'Hung-Fu' AND LastName = 'Ting'"
],
"neg": [
"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",
"SELECT COUNT(T2.ProductID) FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.OnOrderQty IS NULL OR T1.OnOrderQty = 0",
"SELECT COUNT(LocationID) FROM WorkOrderRouting WHERE ActualResourceHrs = 2",
"SELECT T1.AverageLeadTime, T1.LastReceiptCost - T1.StandardPrice, T4.AddressLine1, T4.AddressLine2 , T4.City, T4.PostalCode FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN BusinessEntityAddress AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID INNER JOIN Address AS T4 ON T3.AddressID = T4.AddressID WHERE T1.ProductID = 843",
"SELECT MIN(HireDate) FROM Employee WHERE JobTitle = 'Accountant'",
"SELECT T3.PurchasingWebServiceURL 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 T2.Name = 'Hex Nut 5'",
"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'",
"SELECT DepartmentID FROM Department WHERE GroupName = 'Sales and Marketing'",
"SELECT T1.ListPrice - T2.StandardCost FROM ProductListPriceHistory AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 792",
"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'"
]
} |
{
"query": "What is the average age of employee in Adventure Works?",
"pos": [
"SELECT AVG(STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', BirthDate)) FROM Employee"
],
"neg": [
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 1 GROUP BY T2.Name ORDER BY SUM(T1.Rating) DESC LIMIT 1",
"SELECT T2.ProductID FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName LIKE '%large.gif'",
"SELECT T2.FirstName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.MaritalStatus = 'S' AND T1.Gender = 'M' AND T1.JobTitle LIKE 'Production Supervisor%'",
"SELECT StandardCost FROM ProductCostHistory WHERE ProductID = 847",
"SELECT T1.AverageLeadTime, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 USING (businessentityid) WHERE T2.BusinessEntityID = 1496 GROUP BY T1.AverageLeadTime, T2.Name",
"SELECT TotalDue FROM PurchaseOrderHeader ORDER BY Freight DESC LIMIT 2, 1",
"SELECT 10 * (ListPrice - StandardCost) FROM Product WHERE Weight IS NOT NULL ORDER BY Weight LIMIT 1",
"SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID IN ( SELECT AddressID FROM BusinessEntityAddress WHERE BusinessEntityID = 4 )",
"SELECT T1.ReviewerName FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'M' AND T2.Style = 'W' AND T1.Rating = 5",
"SELECT BusinessEntityID FROM Vendor WHERE CreditRating = ( SELECT CreditRating FROM Vendor ORDER BY CreditRating DESC LIMIT 1 )"
]
} |
{
"query": "What is the total profit gained by the company from the product that has the highest amount of quantity ordered from online customers? Indicate the name of the product.",
"pos": [
"SELECT (T2.ListPrice - T2.StandardCost) * SUM(T1.Quantity), T2.Name FROM ShoppingCartItem AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID, T2.Name, T2.ListPrice, T2.StandardCost, T1.Quantity ORDER BY SUM(T1.Quantity) DESC LIMIT 1"
],
"neg": [
"SELECT T2.CustomerID FROM SalesOrderDetail AS T1 INNER JOIN Customer AS T2 WHERE T1.UnitPrice = 35 AND T1.OrderQty = 32",
"SELECT StandardCost FROM ProductCostHistory WHERE ProductID = 847",
"SELECT FirstName, LastName FROM Person WHERE PersonType = 'EM' ORDER BY BusinessEntityID",
"SELECT PersonType FROM Person WHERE FirstName = 'David' AND LastName = 'Bradley'",
"SELECT BusinessEntityID FROM Vendor WHERE CreditRating = ( SELECT CreditRating FROM Vendor ORDER BY CreditRating DESC LIMIT 1 )",
"SELECT T2.Name FROM ProductListPriceHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T2.Name ORDER BY COUNT(T1.ListPrice) > 3",
"SELECT COUNT(BusinessEntityID) FROM Person WHERE PersonType = 'SC' AND Title = 'Mr.'",
"SELECT SUM(T2.OrderQty) FROM PurchaseOrderHeader AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.PurchaseOrderID = T2.PurchaseOrderID WHERE T1.Status = 1",
"SELECT T2.BusinessEntityID FROM CreditCard AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID WHERE T1.CardNumber = 11113366963373",
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1"
]
} |
{
"query": "What percentage of the AdventureWorks data is in Thai?",
"pos": [
"SELECT CAST(SUM(CASE WHEN T1.Name = 'Thai' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.CultureID) FROM Culture AS T1 INNER JOIN ProductModelProductDescriptionCulture AS T2 ON T1.CultureID = T2.CultureID"
],
"neg": [
"SELECT Name FROM Department WHERE GroupName = 'Executive General and Administration'",
"SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 0 AND (T1.OnOrderQty IS NULL OR T1.OnOrderQty = 0)",
"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",
"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'",
"SELECT T3.PurchasingWebServiceURL 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 T2.Name = 'Hex Nut 5'",
"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'",
"SELECT ProductID FROM ProductListPriceHistory WHERE StartDate LIKE '2012%' ORDER BY ListPrice DESC LIMIT 1",
"SELECT T1.Bonus FROM SalesPerson AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.FirstName = 'Rachel' AND T2.LastName = 'Valdez'",
"SELECT BusinessEntityID FROM SalesPerson ORDER BY SalesYTD DESC LIMIT 1",
"SELECT CAST(COUNT(IIF(T1.PersonType = 'SC', T1.PersonType, NULL)) AS REAL) / COUNT(T1.PersonType) FROM Person AS T1 INNER JOIN Employee AS T2 WHERE T1.PersonType = 'SC' AND T1.NameStyle = 0 AND T2.MaritalStatus = 'M'"
]
} |
{
"query": "What is the minimum inventory quantity of Chainring Bolts?",
"pos": [
"SELECT SafetyStockLevel FROM Product WHERE Name = 'Chainring Bolts'"
],
"neg": [
"SELECT MIN(HireDate) FROM Employee WHERE JobTitle = 'Accountant'",
"SELECT LENGTH(T2.PasswordHash) FROM Person AS T1 INNER JOIN Password AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Catherine' AND T1.LastName = 'Ward'",
"SELECT T1.Name FROM Product AS T1 INNER JOIN SalesOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.SalesOrderID = 43660",
"SELECT SUM(T1.ListPrice - T1.StandardCost) / COUNT(T1.ProductID) 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'",
"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",
"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'",
"SELECT COUNT(T1.ProductID) FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 0 AND T1.Rating != 5",
"SELECT T1.TransactionType FROM TransactionHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Road Frame - Black, 48' AND STRFTIME('%Y-%m-%d',T1.TransactionDate) = '2013-07-31'",
"SELECT COUNT(LocationID) FROM WorkOrderRouting WHERE ActualResourceHrs = 2",
"SELECT T1.AddressLine1, T1.AddressLine2 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T2.BusinessEntityID = 24"
]
} |
{
"query": "What is the stocked quantity of products manufactured from location ID 40?",
"pos": [
"SELECT COUNT(*) FROM WorkOrderRouting AS T1 INNER JOIN BillOfMaterials AS T2 ON T1.LocationID = T2.ProductAssemblyID INNER JOIN WorkOrder AS T3 ON T3.WorkOrderID = T1.WorkOrderID WHERE T1.LocationID = 40"
],
"neg": [
"SELECT T2.BusinessEntityID, STRFTIME('%Y', T2.HireDate) - STRFTIME('%Y', T2.BirthDate) FROM PurchaseOrderHeader AS T1 INNER JOIN Employee AS T2 ON T1.EmployeeID = T2.BusinessEntityID ORDER BY T1.TotalDue DESC LIMIT 1",
"SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID IN ( SELECT AddressID FROM BusinessEntityAddress WHERE BusinessEntityID = 4 )",
"SELECT LocationID FROM Location WHERE Name = 'Debur and Polish'",
"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 T1.Gender = 'M' AND T2.PersonType = 'EM'",
"SELECT 365 * (STRFTIME('%Y', ActualEndDate) - STRFTIME('%Y', ActualStartDate)) + 30 * (STRFTIME('%m', ActualEndDate) - STRFTIME('%m', ActualStartDate)) + STRFTIME('%d', ActualEndDate) - STRFTIME('%d', ActualStartDate) FROM WorkOrderRouting WHERE WorkOrderID = 425",
"SELECT T2.Name FROM ProductListPriceHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T2.Name ORDER BY COUNT(T1.ListPrice) > 3",
"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'",
"SELECT COUNT(BusinessEntityID) FROM SalesPerson WHERE Bonus = 0",
"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'",
"SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'H'"
]
} |
{
"query": "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.",
"pos": [
"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"
],
"neg": [
"SELECT T1.FirstName, T1.LastName FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.MaritalStatus = 'M' AND T2.VacationHours < 20",
"SELECT T2.BusinessEntityID FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T1.City = 'Duvall'",
"SELECT COUNT(T1.TransactionID) FROM TransactionHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Quantity BETWEEN 100 AND 250 AND T2.ReorderPoint <= 375",
"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'",
"SELECT T2.LocationID, T2.Shelf, T2.Bin FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE 'Lock Ring'",
"SELECT Name FROM Vendor WHERE PreferredVendorStatus = 0 LIMIT 3",
"SELECT MIN(HireDate) FROM Employee WHERE JobTitle = 'Accountant'",
"SELECT Status FROM SalesOrderHeader ORDER BY Freight DESC LIMIT 1",
"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",
"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'"
]
} |
{
"query": "What is the number of State Province of France that doesn't have a State Province Code?",
"pos": [
"SELECT T1.CountryRegionCode FROM StateProvince AS T1 INNER JOIN CountryRegion AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode WHERE T2.Name = 'France' AND T1.IsOnlyStateProvinceFlag = 1"
],
"neg": [
"SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.EmailPromotion = 2",
"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'",
"SELECT T2.BusinessEntityID, STRFTIME('%Y', T2.HireDate) - STRFTIME('%Y', T2.BirthDate) FROM PurchaseOrderHeader AS T1 INNER JOIN Employee AS T2 ON T1.EmployeeID = T2.BusinessEntityID ORDER BY T1.TotalDue DESC LIMIT 1",
"SELECT ListPrice - StandardCost FROM Product WHERE ProductID = 740",
"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 )",
"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",
"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'",
"SELECT LastReceiptCost - StandardPrice FROM ProductVendor ORDER BY StandardPrice DESC LIMIT 1",
"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",
"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"
]
} |
{
"query": "Which territory has the most customers as of 9/12/2014?",
"pos": [
"SELECT TerritoryID FROM Customer WHERE ModifiedDate < '2014-12-09' GROUP BY TerritoryID ORDER BY COUNT(TerritoryID) DESC LIMIT 1"
],
"neg": [
"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",
"SELECT COUNT(T1.TransactionID) FROM TransactionHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Quantity BETWEEN 100 AND 250 AND T2.ReorderPoint <= 375",
"SELECT COUNT(*) FROM WorkOrderRouting AS T1 INNER JOIN BillOfMaterials AS T2 ON T1.LocationID = T2.ProductAssemblyID INNER JOIN WorkOrder AS T3 ON T3.WorkOrderID = T1.WorkOrderID WHERE T1.LocationID = 40",
"SELECT ProductID FROM Product WHERE ProductID NOT IN ( SELECT T1.ProductID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID )",
"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",
"SELECT T2.StandardCost, T2.ProductNumber FROM ProductCostHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 888",
"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'",
"SELECT LastReceiptCost - StandardPrice FROM ProductVendor ORDER BY StandardPrice DESC LIMIT 1",
"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'",
"SELECT T1.FirstName, T2.BirthDate FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.BusinessEntityID = 18"
]
} |
{
"query": "List all product names and its product line for all purchase order with order quantity of 5000 or more.",
"pos": [
"SELECT T1.Name, T1.ProductLine FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderQty > 4999"
],
"neg": [
"SELECT COUNT(*) FROM WorkOrderRouting AS T1 INNER JOIN BillOfMaterials AS T2 ON T1.LocationID = T2.ProductAssemblyID INNER JOIN WorkOrder AS T3 ON T3.WorkOrderID = T1.WorkOrderID WHERE T1.LocationID = 40",
"SELECT T2.Suffix FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP' ORDER BY T1.SickLeaveHours DESC LIMIT 1",
"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",
"SELECT T2.ProductID FROM ProductSubcategory AS T1 INNER JOIN Product AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID WHERE T1.Name = 'Socks'",
"SELECT T2.Shelf FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'",
"SELECT T2.StandardCost, T2.ProductNumber FROM ProductCostHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 888",
"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",
"SELECT Description FROM SpecialOffer WHERE Type = 'Seasonal Discount' ORDER BY DiscountPct DESC LIMIT 1",
"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'",
"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'"
]
} |
{
"query": "What are the names of the vendor with the second lowest minimum order quantity?",
"pos": [
"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"
],
"neg": [
"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'",
"SELECT T1.JobTitle FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.Rate ASC LIMIT 1",
"SELECT Name FROM Product ORDER BY ListPrice DESC LIMIT 5",
"SELECT ListPrice FROM ProductListPriceHistory WHERE ProductID = 912",
"SELECT T2.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'LL Fork'",
"SELECT T2.Name FROM ProductListPriceHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T2.Name ORDER BY COUNT(T1.ListPrice) > 3",
"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'",
"SELECT BusinessEntityID FROM SalesPerson WHERE SalesYTD > SalesLastYear + SalesLastyear * 0.6 AND Bonus > 3000",
"SELECT CAST(SUM(CASE WHEN JobTitle = 'Sales Representative' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(BusinessEntityID) FROM Employee",
"SELECT Description, DiscountPct FROM SpecialOffer WHERE Category = 'Reseller' ORDER BY DiscountPct DESC LIMIT 0, 3"
]
} |
{
"query": "What are the salespeople's email addresses?",
"pos": [
"SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SP'"
],
"neg": [
"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'",
"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",
"SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.MaxOrderQty BETWEEN 500 AND 750 ORDER BY T1.LastReceiptCost - T1.StandardPrice DESC LIMIT 9, 1",
"SELECT ReviewerName FROM ProductReview WHERE Rating = 5",
"SELECT DISTINCT Name FROM Product WHERE ListPrice - StandardCost > 100",
"SELECT T1.AverageLeadTime, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 USING (businessentityid) WHERE T2.BusinessEntityID = 1496 GROUP BY T1.AverageLeadTime, T2.Name",
"SELECT CAST(SUM(ActualCost) AS REAL) / COUNT(TransactionID) FROM TransactionHistoryArchive WHERE TransactionType = 'P' AND TransactionDate >= '2012-01-01' AND TransactionDate < '2012-07-01'",
"SELECT T1.ListPrice - T1.StandardCost, T1.Name FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ReviewerName = 'John Smith' ORDER BY T2.Rating DESC LIMIT 1",
"SELECT SUM(T1.ListPrice - T1.StandardCost) / COUNT(T1.ProductID) 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'",
"SELECT COUNT(OrderQty) FROM SalesOrderDetail WHERE ProductID IN ( SELECT ProductID FROM Product WHERE Name = 'Minipump' )"
]
} |
{
"query": "What are the Department ids under the Sales and Marketing Group?",
"pos": [
"SELECT DepartmentID FROM Department WHERE GroupName = 'Sales and Marketing'"
],
"neg": [
"SELECT T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Hex Nut 5' GROUP BY T1.StandardPrice ORDER BY COUNT(T1.StandardPrice) DESC LIMIT 1",
"SELECT T1.Name, T1.ProductLine FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderQty > 4999",
"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",
"SELECT BusinessEntityID FROM Person WHERE Title = 'Mr.' AND FirstName = 'Hung-Fu' AND LastName = 'Ting'",
"SELECT COUNT(*) FROM ShipMethod AS T1 INNER JOIN SalesOrderHeader AS T2 USING (ShipMethodID) WHERE T1.Name = 'XRQ - TRUCK GROUND'",
"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)",
"SELECT SUM(T2.ScrappedQty) FROM ScrapReason AS T1 INNER JOIN WorkOrder AS T2 ON T1.ScrapReasonID = T2.ScrapReasonID WHERE T1.Name = 'Trim length too long'",
"SELECT ListPrice - StandardCost FROM Product WHERE ProductID = 740",
"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",
"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'"
]
} |
{
"query": "Among the products that are purchased, how many of them have never received the highest rating?",
"pos": [
"SELECT COUNT(T1.ProductID) FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 0 AND T1.Rating != 5"
],
"neg": [
"SELECT COUNT(DISTINCT T1.ProductID) FROM SalesOrderDetail AS T1 INNER JOIN SpecialOfferProduct AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID INNER JOIN SpecialOffer AS T3 ON T2.SpecialOfferID = T3.SpecialOfferID WHERE T1.OrderQty > 2 AND T1.UnitPriceDiscount = 0",
"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'",
"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'",
"SELECT TransactionID FROM TransactionHistory WHERE TransactionType = 'W' ORDER BY Quantity DESC LIMIT 1",
"SELECT SUM(CASE WHEN T1.ProductLine = 'M' THEN 1 ELSE 0 END) FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID GROUP BY T1.ProductID HAVING COUNT(T1.Name) > 2",
"SELECT COUNT(BusinessEntityID) FROM SalesPerson WHERE Bonus = 0",
"SELECT T2.StandardCost FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE '%Sport%'",
"SELECT ReviewerName FROM ProductReview WHERE Rating = ( SELECT Rating FROM ProductReview ORDER BY Rating DESC LIMIT 1 )",
"SELECT CAST(COUNT(IIF(T1.PersonType = 'SC', T1.PersonType, NULL)) AS REAL) / COUNT(T1.PersonType) FROM Person AS T1 INNER JOIN Employee AS T2 WHERE T1.PersonType = 'SC' AND T1.NameStyle = 0 AND T2.MaritalStatus = 'M'",
"SELECT SalesYTD - SalesQuota FROM SalesPerson WHERE BusinessEntityID = 288"
]
} |
{
"query": "What rating did Jill give for HL Mountain Pedal?",
"pos": [
"SELECT T1.Rating FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ReviewerName = 'Jill' AND T2.Name = 'HL Mountain Pedal'"
],
"neg": [
"SELECT T1.Name, T2.ReviewerName, T2.Rating, T2.Comments FROM Product AS T1 INNER JOIN ProductReview AS T2 USING (productID) WHERE T1.ProductLine = 'R'",
"SELECT COUNT(T2.CustomerID) FROM SalesTerritory AS T1 INNER JOIN Customer AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.Name = 'Canada'",
"SELECT MAX(T1.Rate) - SUM(T1.Rate) / COUNT(T1.BusinessEntityID) 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 T2.EmailPromotion = 2 AND T3.MaritalStatus = 'M'",
"SELECT StandardCost FROM ProductCostHistory WHERE ProductID = 847",
"SELECT Name FROM Vendor WHERE PreferredVendorStatus = 0 LIMIT 3",
"SELECT T2.Class FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T2.Class ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1",
"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'",
"SELECT T1.LastReceiptCost - T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Freewheel'",
"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",
"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'"
]
} |
{
"query": "Which store sales person was reently hired? Indicate his/her full name and gender.",
"pos": [
"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'"
],
"neg": [
"SELECT COUNT(DISTINCT T2.ProductID) FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName = 'roadster_black_large.gif'",
"SELECT JobTitle FROM Employee WHERE STRFTIME('%Y', HireDate) = '2007' GROUP BY HireDate ORDER BY COUNT(JobTitle) DESC LIMIT 1",
"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",
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1",
"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",
"SELECT LastReceiptCost - StandardPrice FROM ProductVendor ORDER BY StandardPrice DESC LIMIT 1",
"SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277",
"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 )",
"SELECT T2.CustomerID FROM SalesOrderDetail AS T1 INNER JOIN Customer AS T2 WHERE T1.UnitPrice = 35 AND T1.OrderQty = 32",
"SELECT T1.AverageLeadTime, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 USING (businessentityid) WHERE T2.BusinessEntityID = 1496 GROUP BY T1.AverageLeadTime, T2.Name"
]
} |
{
"query": "List all of the credit cards that had expired by 2007.",
"pos": [
"SELECT CardNumber FROM CreditCard WHERE ExpYear < 2007"
],
"neg": [
"SELECT T2.FirstName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.MaritalStatus = 'S' AND T1.Gender = 'M' AND T1.JobTitle LIKE 'Production Supervisor%'",
"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",
"SELECT Name FROM Vendor WHERE PreferredVendorStatus = 0 LIMIT 3",
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 1 GROUP BY T2.Name ORDER BY SUM(T1.Rating) DESC LIMIT 1",
"SELECT StartTime FROM Shift WHERE Name = 'Night'",
"SELECT COUNT(T1.BusinessentityID) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'EM' AND T2.MaritalStatus = 'S'",
"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",
"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",
"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",
"SELECT CASE WHEN ActualCost = PlannedCost THEN 'No' ELSE 'Yes' END FROM WorkOrderRouting"
]
} |
{
"query": "Among the active employees with over 10 hours of sick leave, what is the percentage of the employees with over 20 vacation hours?",
"pos": [
"SELECT CAST(SUM(CASE WHEN T2.VacationHours > 20 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.SickLeaveHours > 10"
],
"neg": [
"SELECT T3.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 T2.Name = 'Hex Nut 5' ORDER BY T1.StandardPrice LIMIT 1",
"SELECT COUNT(T1.TransactionID) FROM TransactionHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Quantity BETWEEN 100 AND 250 AND T2.ReorderPoint <= 375",
"SELECT T1.CountryRegionCode FROM StateProvince AS T1 INNER JOIN CountryRegion AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode WHERE T2.Name = 'France' AND T1.IsOnlyStateProvinceFlag = 1",
"SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'H'",
"SELECT T1.UnitPrice, T3.Name FROM PurchaseOrderDetail AS T1 INNER JOIN PurchaseOrderHeader AS T2 ON T1.PurchaseOrderID = T2.PurchaseOrderID INNER JOIN Vendor AS T3 ON T2.VendorID = T3.BusinessEntityID ORDER BY T1.UnitPrice LIMIT 1",
"SELECT COUNT(T1.LocationID) FROM Location AS T1 INNER JOIN ProductInventory AS T2 USING (LocationID) WHERE T1.Name = 'Subassembly'",
"SELECT Description, DiscountPct FROM SpecialOffer WHERE Category = 'Reseller' ORDER BY DiscountPct DESC LIMIT 0, 3",
"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",
"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",
"SELECT COUNT(DISTINCT T1.Name) FROM SalesTaxRate AS T1 INNER JOIN StateProvince AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.Name = 'Quebec'"
]
} |
{
"query": "How many letters are there in Catherine Ward's e-mail account passwords?",
"pos": [
"SELECT LENGTH(T2.PasswordHash) FROM Person AS T1 INNER JOIN Password AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Catherine' AND T1.LastName = 'Ward'"
],
"neg": [
"SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SP'",
"SELECT JobTitle FROM Employee ORDER BY SickLeaveHours DESC LIMIT 3",
"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'",
"SELECT T2.Shelf FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'",
"SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277",
"SELECT COUNT(BillOfMaterialsID) FROM BillOfMaterials WHERE EndDate IS NULL",
"SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID IN ( SELECT AddressID FROM BusinessEntityAddress WHERE BusinessEntityID = 4 )",
"SELECT ProductID FROM ProductListPriceHistory WHERE StartDate LIKE '2012%' ORDER BY ListPrice DESC LIMIT 1",
"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'",
"SELECT Description, DiscountPct FROM SpecialOffer WHERE Category = 'Reseller' ORDER BY DiscountPct DESC LIMIT 0, 3"
]
} |
{
"query": "Please list the e-mail addresses of all the employees who wish to receive e-mail promotions from Adventureworks and selected partners.",
"pos": [
"SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.EmailPromotion = 2"
],
"neg": [
"SELECT Description, DiscountPct FROM SpecialOffer WHERE Category = 'Reseller' ORDER BY DiscountPct DESC LIMIT 0, 3",
"SELECT (T2.ListPrice - T2.StandardCost) * SUM(T1.Quantity), T2.Name FROM ShoppingCartItem AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID, T2.Name, T2.ListPrice, T2.StandardCost, T1.Quantity ORDER BY SUM(T1.Quantity) DESC LIMIT 1",
"SELECT T2.LocationID, T2.Shelf, T2.Bin FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE 'Lock Ring'",
"SELECT ListPrice - StandardCost FROM Product WHERE ProductID = 740",
"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'",
"SELECT Name, ListPrice FROM Product WHERE Class = 'H'",
"SELECT ListPrice FROM ProductListPriceHistory WHERE ProductID = 912",
"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'",
"SELECT Name FROM Product ORDER BY ListPrice DESC LIMIT 5",
"SELECT T1.Rating FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ReviewerName = 'Jill' AND T2.Name = 'HL Mountain Pedal'"
]
} |
{
"query": "What goods were sold to customers in accordance with sales order number 43660?",
"pos": [
"SELECT T1.Name FROM Product AS T1 INNER JOIN SalesOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.SalesOrderID = 43660"
],
"neg": [
"SELECT SUM(CASE WHEN T2.ProductLine = 'M' THEN 1 ELSE 0 END) FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.FinishedGoodsFlag = 1 GROUP BY T1.ProductID ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1",
"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'",
"SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'H'",
"SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277",
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 1 GROUP BY T2.Name ORDER BY SUM(T1.Rating) DESC LIMIT 1",
"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",
"SELECT ListPrice - StandardCost FROM Product WHERE ProductID = 740",
"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 )",
"SELECT T2.WorkOrderID FROM ScrapReason AS T1 INNER JOIN WorkOrder AS T2 ON T1.ScrapReasonID = T2.ScrapReasonID WHERE T1.Name = 'Handling damage'",
"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'"
]
} |
{
"query": "How much is the tax amount of the purchase order with the biggest tax amount? Indicate the purchase order ID.",
"pos": [
"SELECT TaxAmt, PurchaseOrderID FROM PurchaseOrderHeader ORDER BY TaxAmt DESC LIMIT 1"
],
"neg": [
"SELECT StandardCost FROM ProductCostHistory WHERE ProductID = 847",
"SELECT CASE WHEN ActualCost = PlannedCost THEN 'No' ELSE 'Yes' END FROM WorkOrderRouting",
"SELECT T1.BusinessEntityID, T2.'Group' FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 USING (territoryid) WHERE T1.CommissionPct >= 0.018",
"SELECT COUNT(T2.CustomerID) FROM SalesTerritory AS T1 INNER JOIN Customer AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.Name = 'Canada'",
"SELECT AVG(STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', BirthDate)) FROM Employee",
"SELECT T2.PhoneNumber FROM Person AS T1 INNER JOIN PersonPhone AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SC'",
"SELECT T1.Name, T2.ReviewerName, T2.Rating, T2.Comments FROM Product AS T1 INNER JOIN ProductReview AS T2 USING (productID) WHERE T1.ProductLine = 'R'",
"SELECT T2.BusinessEntityID FROM PhoneNumberType AS T1 INNER JOIN PersonPhone AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID WHERE T1.Name = 'Cell' LIMIT 3",
"SELECT TransactionID FROM TransactionHistory WHERE TransactionType = 'W' ORDER BY Quantity DESC LIMIT 1",
"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'"
]
} |
{
"query": "How many salespersons haven't met quota?",
"pos": [
"SELECT COUNT(BusinessEntityID) FROM SalesPerson WHERE Bonus = 0"
],
"neg": [
"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'",
"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'",
"SELECT T1.PreferredVendorStatus FROM Vendor AS T1 INNER JOIN BusinessEntity AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.rowguid = '684F328D-C185-43B9-AF9A-37ACC680D2AF'",
"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",
"SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.CurrentFlag = 1 AND T2.Title = 'Mr.'",
"SELECT T1.AverageLeadTime, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 USING (businessentityid) WHERE T2.BusinessEntityID = 1496 GROUP BY T1.AverageLeadTime, T2.Name",
"SELECT COUNT(T1.LocationID) FROM Location AS T1 INNER JOIN ProductInventory AS T2 USING (LocationID) WHERE T1.Name = 'Subassembly'",
"SELECT T2.CustomerID FROM SalesOrderDetail AS T1 INNER JOIN Customer AS T2 WHERE T1.UnitPrice = 35 AND T1.OrderQty = 32",
"SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Mountain Pedal' ORDER BY T1.Rating LIMIT 1",
"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'"
]
} |
{
"query": "List down the email address of female single employees.",
"pos": [
"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'"
],
"neg": [
"SELECT T2.Shelf FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'",
"SELECT COUNT(*) FROM BillOfMaterials WHERE BOMLevel = 2 AND EndDate IS NULL",
"SELECT ReviewerName FROM ProductReview WHERE Rating = ( SELECT Rating FROM ProductReview ORDER BY Rating DESC LIMIT 1 )",
"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'",
"SELECT SUM(CASE WHEN T2.ProductLine = 'M' THEN 1 ELSE 0 END) FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.FinishedGoodsFlag = 1 GROUP BY T1.ProductID ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1",
"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",
"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'",
"SELECT T1.Name FROM Product AS T1 INNER JOIN SalesOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.SalesOrderID = 43660",
"SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 0 AND (T1.OnOrderQty IS NULL OR T1.OnOrderQty = 0)",
"SELECT Type FROM SpecialOffer WHERE Category = 'Reseller'"
]
} |
{
"query": "List all the non-sales employees in ascending order of its business entitty ID.",
"pos": [
"SELECT FirstName, LastName FROM Person WHERE PersonType = 'EM' ORDER BY BusinessEntityID"
],
"neg": [
"SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Mountain Pedal' ORDER BY T1.Rating LIMIT 1",
"SELECT T1.CountryRegionCode FROM StateProvince AS T1 INNER JOIN CountryRegion AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode WHERE T2.Name = 'France' AND T1.IsOnlyStateProvinceFlag = 1",
"SELECT SUM(T1.ListPrice - T1.StandardCost) / COUNT(T1.ProductID) 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'",
"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",
"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'",
"SELECT Name, ListPrice FROM Product WHERE Class = 'H'",
"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",
"SELECT T2.CreditRating FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.StandardPrice = 18.9900 AND T1.AverageLeadTime = 16 AND STRFTIME('%Y-%m-%d', T1.LastReceiptDate) = '2011-08-27'",
"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",
"SELECT T2.BusinessEntityID FROM CreditCard AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID WHERE T1.CardNumber = 11113366963373"
]
} |
{
"query": "What is the price for the AWC Logo Cap?",
"pos": [
"SELECT T2.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'AWC Logo Cap'"
],
"neg": [
"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'",
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1",
"SELECT T1.Bonus FROM SalesPerson AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.FirstName = 'Rachel' AND T2.LastName = 'Valdez'",
"SELECT T2.GroupName FROM EmployeeDepartmentHistory AS T1 INNER JOIN Department AS T2 ON T1.DepartmentID = T2.DepartmentID GROUP BY T2.GroupName ORDER BY COUNT(T1.BusinessEntityID) LIMIT 1",
"SELECT SUM(T1.ListPrice - T1.StandardCost) / COUNT(T1.ProductID) 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'",
"SELECT Name FROM Product ORDER BY ListPrice DESC LIMIT 5",
"SELECT T1.AddressLine1, T1.AddressLine2 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T2.BusinessEntityID = 24",
"SELECT T2.Name FROM ProductListPriceHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T2.Name ORDER BY COUNT(T1.ListPrice) > 3",
"SELECT COUNT(T2.ProductID) FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.OnOrderQty IS NULL OR T1.OnOrderQty = 0",
"SELECT COUNT(SalesTaxRateID) FROM SalesTaxRate WHERE Name LIKE '%+%'"
]
} |
{
"query": "How many products using \"roadster_black_small.gif\" as the thumbnail photo?",
"pos": [
"SELECT COUNT(DISTINCT T2.ProductID) FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName = 'roadster_black_large.gif'"
],
"neg": [
"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'",
"SELECT T2.WorkOrderID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'",
"SELECT COUNT(T2.CustomerID) FROM SalesTerritory AS T1 INNER JOIN Customer AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.Name = 'Canada'",
"SELECT SUM(CASE WHEN T2.ProductLine = 'M' THEN 1 ELSE 0 END) FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID HAVING COUNT(T1.ProductReviewID) > 1",
"SELECT LastReceiptCost - StandardPrice FROM ProductVendor ORDER BY StandardPrice DESC LIMIT 1",
"SELECT T1.PreferredVendorStatus FROM Vendor AS T1 INNER JOIN BusinessEntity AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.rowguid = '684F328D-C185-43B9-AF9A-37ACC680D2AF'",
"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'",
"SELECT SUM(CASE WHEN T1.ProductLine = 'M' THEN 1 ELSE 0 END) FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID GROUP BY T1.ProductID HAVING COUNT(T1.Name) > 2",
"SELECT T1.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ListPrice - T1.StandardCost > 21.9037 AND STRFTIME('%Y-%m-%d', T2.StartDate) >= '2012-10-01'",
"SELECT CAST(SUM(CASE WHEN T2.Gender = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessentityID) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessentityID = T2.BusinessentityID WHERE T1.PersonType = 'EM'"
]
} |
{
"query": "How many employees working in the Engineering Department in 2007 would have their credit cards expired in the same year?",
"pos": [
"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'"
],
"neg": [
"SELECT SUM(T1.SickLeaveHours) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 0",
"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'",
"SELECT JobTitle FROM Employee WHERE STRFTIME('%Y', HireDate) = '2007' GROUP BY HireDate ORDER BY COUNT(JobTitle) DESC LIMIT 1",
"SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Mountain Pedal' ORDER BY T1.Rating LIMIT 1",
"SELECT CAST(SUM(CASE WHEN OrderQty < 3 AND UnitPriceDiscount = 0.2 THEN 1 ELSE 0 END) AS REAL) / COUNT(SalesOrderID) FROM SalesOrderDetail",
"SELECT T1.ReviewerName FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'M' AND T2.Style = 'W' AND T1.Rating = 5",
"SELECT T1.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ListPrice - T1.StandardCost > 21.9037 AND STRFTIME('%Y-%m-%d', T2.StartDate) >= '2012-10-01'",
"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",
"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 )",
"SELECT T1.CountryRegionCode FROM StateProvince AS T1 INNER JOIN CountryRegion AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode WHERE T2.Name = 'France' AND T1.IsOnlyStateProvinceFlag = 1"
]
} |
{
"query": "Which is a high quality product but with the lowest transacted quantity?",
"pos": [
"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"
],
"neg": [
"SELECT COUNT(DocumentNode) FROM Document WHERE DocumentSummary IS NULL",
"SELECT Name FROM Vendor WHERE PreferredVendorStatus = 0 LIMIT 3",
"SELECT TotalDue FROM PurchaseOrderHeader ORDER BY Freight DESC LIMIT 2, 1",
"SELECT Status FROM SalesOrderHeader ORDER BY Freight DESC LIMIT 1",
"SELECT T1.Rating FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ReviewerName = 'Jill' AND T2.Name = 'HL Mountain Pedal'",
"SELECT 10 * (ListPrice - StandardCost) FROM Product WHERE Weight IS NOT NULL ORDER BY Weight LIMIT 1",
"SELECT T1.FirstName, T2.BirthDate FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.BusinessEntityID = 18",
"SELECT Name FROM SalesTerritory WHERE CountryRegionCode = 'US' AND (Name = 'Northwest' OR Name = 'Southeast') ORDER BY SalesLastYear DESC LIMIT 1",
"SELECT T2.ThumbnailPhotoFileName FROM ProductProductPhoto AS T1 INNER JOIN ProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.ProductID = 979",
"SELECT T2.StandardCost, T2.ProductNumber FROM ProductCostHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 888"
]
} |
{
"query": "What is the sales revenue for item number 740?",
"pos": [
"SELECT ListPrice - StandardCost FROM Product WHERE ProductID = 740"
],
"neg": [
"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",
"SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 0 AND (T1.OnOrderQty IS NULL OR T1.OnOrderQty = 0)",
"SELECT T1.CountryRegionCode FROM StateProvince AS T1 INNER JOIN CountryRegion AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode WHERE T2.Name = 'France' AND T1.IsOnlyStateProvinceFlag = 1",
"SELECT T2.LastReceiptCost - T2.StandardPrice FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE '%Crankarm%'",
"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",
"SELECT TransactionID FROM TransactionHistory WHERE TransactionType = 'W' ORDER BY Quantity DESC LIMIT 1",
"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",
"SELECT T1.AverageLeadTime, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 USING (businessentityid) WHERE T2.BusinessEntityID = 1496 GROUP BY T1.AverageLeadTime, T2.Name",
"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'",
"SELECT Name FROM Vendor WHERE PreferredVendorStatus = 0 LIMIT 3"
]
} |
{
"query": "Please list the e-mails of the reviewers who have reviewed high class.",
"pos": [
"SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'H'"
],
"neg": [
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ProductLine = 'M' GROUP BY T2.Name ORDER BY CAST(SUM(T1.Rating) AS REAL) / COUNT(T1.ProductID) DESC LIMIT 1",
"SELECT ProductID FROM Product WHERE ProductID NOT IN ( SELECT T1.ProductID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID )",
"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",
"SELECT T2.BusinessEntityID FROM CreditCard AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID WHERE T1.CardNumber = 11113366963373",
"SELECT PersonType FROM Person WHERE FirstName = 'David' AND LastName = 'Bradley'",
"SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 0 AND (T1.OnOrderQty IS NULL OR T1.OnOrderQty = 0)",
"SELECT T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Hex Nut 5' GROUP BY T1.StandardPrice ORDER BY COUNT(T1.StandardPrice) DESC LIMIT 1",
"SELECT Status FROM SalesOrderHeader ORDER BY Freight DESC LIMIT 1",
"SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.Gender = 'M' AND T1.PayFrequency = 2",
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 1 GROUP BY T2.Name ORDER BY SUM(T1.Rating) DESC LIMIT 1"
]
} |
{
"query": "What is the total shipment by \"cargo transport 5\" cost of all purchase orders created on 12/14/2011?",
"pos": [
"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'"
],
"neg": [
"SELECT COUNT(DISTINCT T2.ProductID) FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName = 'roadster_black_large.gif'",
"SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID IN ( SELECT AddressID FROM BusinessEntityAddress WHERE BusinessEntityID = 4 )",
"SELECT CAST(SUM(CASE WHEN JobTitle = 'Sales Representative' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(BusinessEntityID) FROM Employee",
"SELECT T2.ReferenceOrderID FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Mountain End Caps'",
"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'",
"SELECT Description, DiscountPct FROM SpecialOffer WHERE Category = 'Reseller' ORDER BY DiscountPct DESC LIMIT 0, 3",
"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'",
"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'",
"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'",
"SELECT T2.LocationID, T2.Shelf, T2.Bin FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE 'Lock Ring'"
]
} |
{
"query": "Among the active employees, how many of them have a courtesy title of \"Mr\"?",
"pos": [
"SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.CurrentFlag = 1 AND T2.Title = 'Mr.'"
],
"neg": [
"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",
"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'",
"SELECT COUNT(BillOfMaterialsID) FROM BillOfMaterials WHERE EndDate IS NULL",
"SELECT T2.ProductID FROM ProductSubcategory AS T1 INNER JOIN Product AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID WHERE T1.Name = 'Socks'",
"SELECT T1.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ListPrice - T1.StandardCost > 21.9037 AND STRFTIME('%Y-%m-%d', T2.StartDate) >= '2012-10-01'",
"SELECT T1.PreferredVendorStatus FROM Vendor AS T1 INNER JOIN BusinessEntity AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.rowguid = '684F328D-C185-43B9-AF9A-37ACC680D2AF'",
"SELECT JobTitle FROM Employee WHERE STRFTIME('%Y', HireDate) = '2007' GROUP BY HireDate ORDER BY COUNT(JobTitle) DESC LIMIT 1",
"SELECT LastReceiptCost - StandardPrice FROM ProductVendor WHERE BusinessEntityID = 1580",
"SELECT Name FROM Department WHERE GroupName = 'Executive General and Administration'",
"SELECT AVG(STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', BirthDate)) FROM Employee"
]
} |
{
"query": "Which sales areas are expected to have the highest yearly sales quota?",
"pos": [
"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"
],
"neg": [
"SELECT T2.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'LL Fork'",
"SELECT COUNT(*) FROM WorkOrderRouting AS T1 INNER JOIN BillOfMaterials AS T2 ON T1.LocationID = T2.ProductAssemblyID INNER JOIN WorkOrder AS T3 ON T3.WorkOrderID = T1.WorkOrderID WHERE T1.LocationID = 40",
"SELECT Name, ListPrice FROM Product WHERE Class = 'H'",
"SELECT COUNT(BusinessEntityID) FROM SalesPerson WHERE Bonus = 0",
"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'",
"SELECT COUNT(BusinessEntityID) FROM Employee WHERE MaritalStatus = 's' AND BirthDate < '1980-1-1'",
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 1 GROUP BY T2.Name ORDER BY SUM(T1.Rating) DESC LIMIT 1",
"SELECT T1.TransactionType FROM TransactionHistoryArchive AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'LL Road Handlebars' AND STRFTIME('%Y-%m-%d',T1.TransactionDate) = '2012-11-03'",
"SELECT T2.ThumbnailPhotoFileName FROM ProductProductPhoto AS T1 INNER JOIN ProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.ProductID = 979",
"SELECT SUM(FinishedGoodsFlag) FROM Product WHERE MakeFlag = 1"
]
} |
{
"query": "What is the person's business ID with a vista credit card number \"11113366963373\"?",
"pos": [
"SELECT T2.BusinessEntityID FROM CreditCard AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID WHERE T1.CardNumber = 11113366963373"
],
"neg": [
"SELECT T2.Shelf FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'",
"SELECT COUNT(LocationID) FROM WorkOrderRouting WHERE ActualResourceHrs = 2",
"SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SP'",
"SELECT T2.GroupName FROM EmployeeDepartmentHistory AS T1 INNER JOIN Department AS T2 ON T1.DepartmentID = T2.DepartmentID GROUP BY T2.GroupName ORDER BY COUNT(T1.BusinessEntityID) LIMIT 1",
"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",
"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",
"SELECT T2.LocationID, T2.Shelf, T2.Bin FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE 'Lock Ring'",
"SELECT T1.ProductID FROM ProductListPriceHistory AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID ORDER BY T1.ListPrice - T2.StandardCost DESC LIMIT 1",
"SELECT COUNT(DocumentNode) FROM Document WHERE DocumentSummary IS NULL",
"SELECT Status FROM SalesOrderHeader ORDER BY Freight DESC LIMIT 1"
]
} |
{
"query": "What is the job position of the oldest employee?",
"pos": [
"SELECT T2.PersonType FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.BirthDate ASC LIMIT 1"
],
"neg": [
"SELECT T2.Suffix FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP' ORDER BY T1.SickLeaveHours DESC LIMIT 1",
"SELECT SUM(Quantity) FROM TransactionHistory WHERE TransactionDate LIKE '2013-08%' AND TransactionType = 'S' AND ProductID = 989",
"SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.EmailPromotion = 2",
"SELECT StandardCost FROM ProductCostHistory WHERE ProductID = 847",
"SELECT SUM(T1.SickLeaveHours) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 0",
"SELECT Title FROM Document WHERE Status = 1",
"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",
"SELECT COUNT(BillOfMaterialsID) FROM BillOfMaterials WHERE EndDate IS NULL",
"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'",
"SELECT COUNT(LocationID) FROM WorkOrderRouting WHERE ActualResourceHrs = 2"
]
} |
{
"query": "Provide all the transactions whereby the quantiy is more than 10,000 pieces. State the product name and the selling price.",
"pos": [
"SELECT DISTINCT T1.Name, T1.ListPrice FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 10000"
],
"neg": [
"SELECT COUNT(CreditCardID) FROM CreditCard WHERE CardType = 'Vista' AND ExpYear < 2007",
"SELECT SUM(T1.StandardPrice) / COUNT(T1.BusinessEntityID) FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Hex Nut 5'",
"SELECT TaxAmt, PurchaseOrderID FROM PurchaseOrderHeader ORDER BY TaxAmt DESC LIMIT 1",
"SELECT T2.City, T1.Name, T1.IsOnlyStateProvinceFlag FROM StateProvince AS T1 INNER JOIN Address AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.AddressID = 15873",
"SELECT T2.ProductID FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName LIKE '%large.gif'",
"SELECT SUM(Quantity) FROM TransactionHistory WHERE TransactionDate LIKE '2013-08%' AND TransactionType = 'S' AND ProductID = 989",
"SELECT SUM(T1.SickLeaveHours) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 0",
"SELECT CurrencyCode FROM Currency WHERE Name = 'Mauritius Rupee'",
"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",
"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'"
]
} |
{
"query": "How many location IDs have actual resource hours of 2?",
"pos": [
"SELECT COUNT(LocationID) FROM WorkOrderRouting WHERE ActualResourceHrs = 2"
],
"neg": [
"SELECT (T2.ListPrice - T2.StandardCost) * SUM(T1.Quantity), T2.Name FROM ShoppingCartItem AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID, T2.Name, T2.ListPrice, T2.StandardCost, T1.Quantity ORDER BY SUM(T1.Quantity) DESC LIMIT 1",
"SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'H'",
"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 )",
"SELECT COUNT(BusinessEntityID) FROM Person WHERE PersonType = 'SC' AND Title = 'Mr.'",
"SELECT T1.CountryRegionCode FROM StateProvince AS T1 INNER JOIN CountryRegion AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode WHERE T2.Name = 'France' AND T1.IsOnlyStateProvinceFlag = 1",
"SELECT T2.Class FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T2.Class ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1",
"SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.Gender = 'M' AND T1.PayFrequency = 2",
"SELECT Name, ListPrice FROM Product WHERE Class = 'H'",
"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",
"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'"
]
} |
{
"query": "Where is the address 15873 located, in what city and state? Does that city belong to a province where the code exists?",
"pos": [
"SELECT T2.City, T1.Name, T1.IsOnlyStateProvinceFlag FROM StateProvince AS T1 INNER JOIN Address AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.AddressID = 15873"
],
"neg": [
"SELECT BusinessEntityID FROM SalesPerson ORDER BY SalesYTD DESC LIMIT 1",
"SELECT T1.ListPrice - T1.StandardCost, T1.Name FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ReviewerName = 'John Smith' ORDER BY T2.Rating DESC LIMIT 1",
"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'",
"SELECT ProductID FROM ProductListPriceHistory WHERE StartDate LIKE '2012%' ORDER BY ListPrice DESC LIMIT 1",
"SELECT T2.BusinessEntityID FROM PhoneNumberType AS T1 INNER JOIN PersonPhone AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID WHERE T1.Name = 'Cell' LIMIT 3",
"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'",
"SELECT T2.Shelf FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'",
"SELECT TaxAmt, PurchaseOrderID FROM PurchaseOrderHeader ORDER BY TaxAmt DESC LIMIT 1",
"SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.Gender = 'M' AND T1.PayFrequency = 2",
"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'"
]
} |
{
"query": "Please list the top 3 house-manufactured products with the highest average rating.",
"pos": [
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 1 GROUP BY T2.Name ORDER BY SUM(T1.Rating) DESC LIMIT 1"
],
"neg": [
"SELECT T2.ThumbnailPhotoFileName FROM ProductProductPhoto AS T1 INNER JOIN ProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.ProductID = 979",
"SELECT COUNT(T2.ProductID) FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.OnOrderQty IS NULL OR T1.OnOrderQty = 0",
"SELECT COUNT(T2.BusinessEntityID) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.BirthDate = '1975-12-25' AND T1.DocumentSummary IS NULL",
"SELECT TransactionID FROM TransactionHistory WHERE TransactionType = 'W' ORDER BY Quantity DESC LIMIT 1",
"SELECT SUM(T2.ScrappedQty) FROM ScrapReason AS T1 INNER JOIN WorkOrder AS T2 ON T1.ScrapReasonID = T2.ScrapReasonID WHERE T1.Name = 'Trim length too long'",
"SELECT COUNT(CreditCardID) FROM CreditCard WHERE CardType = 'Vista' AND ExpYear < 2007",
"SELECT T2.BusinessEntityID, STRFTIME('%Y', T2.HireDate) - STRFTIME('%Y', T2.BirthDate) FROM PurchaseOrderHeader AS T1 INNER JOIN Employee AS T2 ON T1.EmployeeID = T2.BusinessEntityID ORDER BY T1.TotalDue DESC LIMIT 1",
"SELECT CAST(SUM(CASE WHEN JobTitle = 'Sales Representative' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(BusinessEntityID) FROM Employee",
"SELECT CAST(SUM(CASE WHEN T2.Gender = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessentityID) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessentityID = T2.BusinessentityID WHERE T1.PersonType = 'EM'",
"SELECT T2.ProductID FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName LIKE '%large.gif'"
]
} |
{
"query": "What is the average selling price of different vendors of the product Hex Nut 5?",
"pos": [
"SELECT SUM(T1.StandardPrice) / COUNT(T1.BusinessEntityID) FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Hex Nut 5'"
],
"neg": [
"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",
"SELECT COUNT(*) FROM ProductCategory AS T1 INNER JOIN ProductSubcategory AS T2 ON T1.ProductCategoryID = T2.ProductCategoryID WHERE T1.Name = 'Bikes'",
"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'",
"SELECT Type FROM SpecialOffer WHERE Category = 'Reseller'",
"SELECT T1.TransactionType FROM TransactionHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Road Frame - Black, 48' AND STRFTIME('%Y-%m-%d',T1.TransactionDate) = '2013-07-31'",
"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'",
"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",
"SELECT DISTINCT T1.Name, T1.ListPrice FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 10000",
"SELECT DISTINCT ProductID FROM ProductVendor WHERE StandardPrice - LastReceiptCost < 0",
"SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.MaxOrderQty BETWEEN 500 AND 750 ORDER BY T1.LastReceiptCost - T1.StandardPrice DESC LIMIT 9, 1"
]
} |
{
"query": "Among the salable products from the mountain product line, how many of them have the most reviews?",
"pos": [
"SELECT SUM(CASE WHEN T2.ProductLine = 'M' THEN 1 ELSE 0 END) FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.FinishedGoodsFlag = 1 GROUP BY T1.ProductID ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1"
],
"neg": [
"SELECT 365 * (STRFTIME('%Y', ActualEndDate) - STRFTIME('%Y', ActualStartDate)) + 30 * (STRFTIME('%m', ActualEndDate) - STRFTIME('%m', ActualStartDate)) + STRFTIME('%d', ActualEndDate) - STRFTIME('%d', ActualStartDate) FROM WorkOrderRouting WHERE WorkOrderID = 425",
"SELECT AVG(T2.Rate) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID GROUP BY T1.Gender",
"SELECT Name FROM Vendor WHERE PreferredVendorStatus = 0 LIMIT 3",
"SELECT SUM(FinishedGoodsFlag) FROM Product WHERE MakeFlag = 1",
"SELECT T1.ListPrice - T1.StandardCost, T1.Name FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ReviewerName = 'John Smith' ORDER BY T2.Rating DESC LIMIT 1",
"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'",
"SELECT T1.UnitPrice, T3.Name FROM PurchaseOrderDetail AS T1 INNER JOIN PurchaseOrderHeader AS T2 ON T1.PurchaseOrderID = T2.PurchaseOrderID INNER JOIN Vendor AS T3 ON T2.VendorID = T3.BusinessEntityID ORDER BY T1.UnitPrice LIMIT 1",
"SELECT T2.ThumbnailPhotoFileName FROM ProductProductPhoto AS T1 INNER JOIN ProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.ProductID = 979",
"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'",
"SELECT Name FROM Department WHERE GroupName = 'Executive General and Administration'"
]
} |
{
"query": "What is the product description of Headset Ball Bearings?",
"pos": [
"SELECT T1.Description FROM ProductDescription AS T1 INNER JOIN Product AS T2 WHERE T2.Name = 'Headset Ball Bearings' AND T1.productDescriptionID = T2.ProductID"
],
"neg": [
"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'",
"SELECT COUNT(DISTINCT T1.ProductID) FROM SalesOrderDetail AS T1 INNER JOIN SpecialOfferProduct AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID INNER JOIN SpecialOffer AS T3 ON T2.SpecialOfferID = T3.SpecialOfferID WHERE T1.OrderQty > 2 AND T1.UnitPriceDiscount = 0",
"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",
"SELECT COUNT(T2.CustomerID) FROM SalesTerritory AS T1 INNER JOIN Customer AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.Name = 'Canada'",
"SELECT T2.City, T1.Name, T1.IsOnlyStateProvinceFlag FROM StateProvince AS T1 INNER JOIN Address AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.AddressID = 15873",
"SELECT Name FROM SalesTerritory WHERE CountryRegionCode = 'US' AND (Name = 'Northwest' OR Name = 'Southeast') ORDER BY SalesLastYear DESC LIMIT 1",
"SELECT T2.ProductID FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName LIKE '%large.gif'",
"SELECT T2.GroupName FROM EmployeeDepartmentHistory AS T1 INNER JOIN Department AS T2 ON T1.DepartmentID = T2.DepartmentID GROUP BY T2.GroupName ORDER BY COUNT(T1.BusinessEntityID) LIMIT 1",
"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",
"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'"
]
} |
{
"query": "State the product name, product line, rating and the selling price of product with the lowest rating.",
"pos": [
"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"
],
"neg": [
"SELECT SUM(T1.PerAssemblyQty), T2.Name FROM BillOfMaterials AS T1 INNER JOIN UnitMeasure AS T2 ON T1.UnitMeasureCode = T2.UnitMeasureCode WHERE T1.UnitMeasureCode IN ('EA', 'IN', 'OZ') GROUP BY T2.Name",
"SELECT T1.TransactionType FROM TransactionHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Road Frame - Black, 48' AND STRFTIME('%Y-%m-%d',T1.TransactionDate) = '2013-07-31'",
"SELECT OrderQty FROM PurchaseOrderDetail ORDER BY UnitPrice DESC LIMIT 1",
"SELECT SUM(CASE WHEN T2.ProductLine = 'M' THEN 1 ELSE 0 END) FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID HAVING COUNT(T1.ProductReviewID) > 1",
"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'",
"SELECT CAST(SUM(CASE WHEN JobTitle = 'Sales Representative' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(BusinessEntityID) FROM Employee",
"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'",
"SELECT T2.CreditRating FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.StandardPrice = 18.9900 AND T1.AverageLeadTime = 16 AND STRFTIME('%Y-%m-%d', T1.LastReceiptDate) = '2011-08-27'",
"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",
"SELECT Name, ReorderPoint FROM Product WHERE SizeUnitMeasureCode = 'CM' ORDER BY Size DESC LIMIT 6"
]
} |
{
"query": "How long does it take for the business to receive the item it has purchased? Who is the vendor for business number 1496?",
"pos": [
"SELECT T1.AverageLeadTime, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 USING (businessentityid) WHERE T2.BusinessEntityID = 1496 GROUP BY T1.AverageLeadTime, T2.Name"
],
"neg": [
"SELECT T3.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 T2.Name = 'Hex Nut 5' ORDER BY T1.StandardPrice LIMIT 1",
"SELECT T1.FirstName, T1.LastName FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.MaritalStatus = 'M' AND T2.VacationHours < 20",
"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'",
"SELECT T2.StandardCost FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE '%Sport%'",
"SELECT T2.ProductID FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName LIKE '%large.gif'",
"SELECT DISTINCT Name FROM Product WHERE ListPrice - StandardCost > 100",
"SELECT TaxAmt, PurchaseOrderID FROM PurchaseOrderHeader ORDER BY TaxAmt DESC LIMIT 1",
"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'",
"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'",
"SELECT CardNumber FROM CreditCard WHERE ExpYear < 2007"
]
} |
{
"query": "To the products which could make the profit as 21.9037, what were their list price after October of 2012?",
"pos": [
"SELECT T1.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ListPrice - T1.StandardCost > 21.9037 AND STRFTIME('%Y-%m-%d', T2.StartDate) >= '2012-10-01'"
],
"neg": [
"SELECT Title FROM Document WHERE Status = 1",
"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",
"SELECT TransactionID FROM TransactionHistory WHERE TransactionType = 'W' ORDER BY Quantity DESC LIMIT 1",
"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",
"SELECT COUNT(CreditCardID) FROM CreditCard WHERE CardType = 'Vista' AND ExpYear < 2007",
"SELECT COUNT(DISTINCT T2.ProductID) FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName = 'roadster_black_large.gif'",
"SELECT T1.FirstName, T1.LastName FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T2.HireDate) >= '2007' AND T2.SalariedFlag = 1",
"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'",
"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",
"SELECT T1.ListPrice - T2.StandardCost FROM ProductListPriceHistory AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 792"
]
} |
{
"query": "Where does the person with the BusinessEntityID \"5555\" live?",
"pos": [
"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'"
],
"neg": [
"SELECT JobTitle FROM Employee WHERE STRFTIME('%Y', HireDate) = '2007' GROUP BY HireDate ORDER BY COUNT(JobTitle) DESC LIMIT 1",
"SELECT COUNT(BusinessEntityID) FROM Person WHERE PersonType = 'SC' AND Title = 'Mr.'",
"SELECT T1.AverageLeadTime, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 USING (businessentityid) WHERE T2.BusinessEntityID = 1496 GROUP BY T1.AverageLeadTime, T2.Name",
"SELECT COUNT(LocationID) FROM WorkOrderRouting WHERE ActualResourceHrs = 2",
"SELECT T2.Name FROM ProductSubcategory AS T1 INNER JOIN ProductCategory AS T2 ON T1.ProductCategoryID = T2.ProductCategoryID WHERE T1.Name = 'Road Frames'",
"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 T1.Gender = 'M' AND T2.PersonType = 'EM'",
"SELECT StandardCost FROM ProductCostHistory WHERE ProductID = 847",
"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'",
"SELECT T2.OrderQty - T2.ReceivedQty, VendorID FROM PurchaseOrderHeader AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.PurchaseOrderID = T2.PurchaseOrderID ORDER BY T2.OrderQty - T2.ReceivedQty DESC LIMIT 1",
"SELECT T1.ReviewerName FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'M' AND T2.Style = 'W' AND T1.Rating = 5"
]
} |
{
"query": "Which chromoly steel product model has AdventureWorks saved in English?",
"pos": [
"SELECT T1.ProductModelID FROM ProductModelProductDescriptionCulture AS T1 INNER JOIN Culture AS T2 USING (cultureid) INNER JOIN ProductDescription AS T3 USING (productdescriptionid) WHERE T3.Description LIKE 'Chromoly steel%' AND T2.Name = 'English'"
],
"neg": [
"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",
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ProductLine = 'M' GROUP BY T2.Name ORDER BY CAST(SUM(T1.Rating) AS REAL) / COUNT(T1.ProductID) DESC LIMIT 1",
"SELECT ListPrice - StandardCost FROM Product WHERE ProductID = 740",
"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'",
"SELECT OrderQty FROM PurchaseOrderDetail ORDER BY UnitPrice DESC LIMIT 1",
"SELECT T1.AverageLeadTime, T1.LastReceiptCost - T1.StandardPrice, T4.AddressLine1, T4.AddressLine2 , T4.City, T4.PostalCode FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN BusinessEntityAddress AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID INNER JOIN Address AS T4 ON T3.AddressID = T4.AddressID WHERE T1.ProductID = 843",
"SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277",
"SELECT T2.ThumbnailPhotoFileName FROM ProductProductPhoto AS T1 INNER JOIN ProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.ProductID = 979",
"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'",
"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"
]
} |
{
"query": "Please show the credit card number of David Bradley.",
"pos": [
"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'"
],
"neg": [
"SELECT T2.ReferenceOrderID FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Mountain End Caps'",
"SELECT T2.PayFrequency FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.SickLeaveHours ASC LIMIT 1",
"SELECT T1.CountryRegionCode FROM StateProvince AS T1 INNER JOIN CountryRegion AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode WHERE T2.Name = 'France' AND T1.IsOnlyStateProvinceFlag = 1",
"SELECT T1.ReviewerName FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'M' AND T2.Style = 'W' AND T1.Rating = 5",
"SELECT T2.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'LL Fork'",
"SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277",
"SELECT CAST(SUM(CASE WHEN T2.VacationHours > 20 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.SickLeaveHours > 10",
"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'",
"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'",
"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"
]
} |
{
"query": "Which product gets the most reviews?",
"pos": [
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1"
],
"neg": [
"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",
"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",
"SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.Gender = 'M' AND T1.PayFrequency = 2",
"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'",
"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",
"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",
"SELECT FirstName, MiddleName, LastName FROM Person WHERE BusinessEntityID = 1 AND PersonType = 'EM'",
"SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277",
"SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID IN ( SELECT AddressID FROM BusinessEntityAddress WHERE BusinessEntityID = 4 )",
"SELECT T2.NAME FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.FinishedGoodsFlag = 1 GROUP BY T2.NAME ORDER BY COUNT(T1.comments) > 10"
]
} |
{
"query": "Please list the website purchasing links of the vendors from whom the product Hex Nut 5 can be purchased.",
"pos": [
"SELECT T3.PurchasingWebServiceURL 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 T2.Name = 'Hex Nut 5'"
],
"neg": [
"SELECT TerritoryID FROM Customer WHERE ModifiedDate < '2014-12-09' GROUP BY TerritoryID ORDER BY COUNT(TerritoryID) DESC LIMIT 1",
"SELECT FirstName, MiddleName, LastName FROM Person WHERE BusinessEntityID = 1 AND PersonType = 'EM'",
"SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.CurrentFlag = 1 AND T2.Title = 'Mr.'",
"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'",
"SELECT T2.PhoneNumber FROM Person AS T1 INNER JOIN PersonPhone AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SC'",
"SELECT Type FROM SpecialOffer WHERE Category = 'Reseller'",
"SELECT TaxAmt, PurchaseOrderID FROM PurchaseOrderHeader ORDER BY TaxAmt DESC LIMIT 1",
"SELECT Title FROM Document WHERE Status = 1",
"SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277",
"SELECT T2.WorkOrderID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'"
]
} |
{
"query": "What is the name of the territory assigned to the sales person with business id \"277\"?",
"pos": [
"SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277"
],
"neg": [
"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",
"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",
"SELECT CAST(SUM(CASE WHEN T1.DocumentSummary IS NOT NULL THEN 1 ELSE 0 END) AS REAL) / COUNT(T1.DocumentSummary) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.HireDate = '2009-01-22'",
"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'",
"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'",
"SELECT COUNT(BusinessEntityID) FROM SalesPerson WHERE Bonus = 0",
"SELECT MAX(T1.Rate) - SUM(T1.Rate) / COUNT(T1.BusinessEntityID) 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 T2.EmailPromotion = 2 AND T3.MaritalStatus = 'M'",
"SELECT CurrencyCode FROM Currency WHERE Name = 'Mauritius Rupee'",
"SELECT AVG(T2.StandardCost) FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductNumber = 'CA-1098'",
"SELECT ProductID FROM ProductListPriceHistory WHERE StartDate LIKE '2012%' ORDER BY ListPrice DESC LIMIT 1"
]
} |
{
"query": "What is the current payrate of Rob Walters? Calculate the percentage increment from his previous payrate.",
"pos": [
"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'"
],
"neg": [
"SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Mountain Pedal' ORDER BY T1.Rating LIMIT 1",
"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",
"SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SP'",
"SELECT CAST(SUM(CASE WHEN T2.VacationHours > 20 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.SickLeaveHours > 10",
"SELECT COUNT(SalesTaxRateID) FROM SalesTaxRate WHERE Name LIKE '%+%'",
"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 T1.Gender = 'M' AND T2.PersonType = 'EM'",
"SELECT FirstName, MiddleName, LastName FROM Person WHERE BusinessEntityID = 1 AND PersonType = 'EM'",
"SELECT T2.WorkOrderID FROM ScrapReason AS T1 INNER JOIN WorkOrder AS T2 ON T1.ScrapReasonID = T2.ScrapReasonID WHERE T1.Name = 'Handling damage'",
"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'",
"SELECT ReviewerName FROM ProductReview WHERE Rating = ( SELECT Rating FROM ProductReview ORDER BY Rating DESC LIMIT 1 )"
]
} |
{
"query": "What is the employee of company number 1's full name?",
"pos": [
"SELECT FirstName, MiddleName, LastName FROM Person WHERE BusinessEntityID = 1 AND PersonType = 'EM'"
],
"neg": [
"SELECT COUNT(T1.LocationID) FROM Location AS T1 INNER JOIN ProductInventory AS T2 USING (LocationID) WHERE T1.Name = 'Subassembly'",
"SELECT SUM(T2.OrderQty) FROM PurchaseOrderHeader AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.PurchaseOrderID = T2.PurchaseOrderID WHERE T1.Status = 1",
"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'",
"SELECT COUNT(DocumentNode) FROM Document WHERE Status = 2 AND DocumentSummary IS NULL",
"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'",
"SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.Gender = 'M' AND T1.PayFrequency = 2",
"SELECT FirstName, LastName FROM Person WHERE PersonType = 'EM' ORDER BY BusinessEntityID",
"SELECT T2.ProductID FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName LIKE '%large.gif'",
"SELECT T2.CreditRating FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.StandardPrice = 18.9900 AND T1.AverageLeadTime = 16 AND STRFTIME('%Y-%m-%d', T1.LastReceiptDate) = '2011-08-27'",
"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'"
]
} |
{
"query": "Among the employees who are married and wish to receive e-mail promotions, how much higher is their highest pay rate from the average pay rate?",
"pos": [
"SELECT MAX(T1.Rate) - SUM(T1.Rate) / COUNT(T1.BusinessEntityID) 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 T2.EmailPromotion = 2 AND T3.MaritalStatus = 'M'"
],
"neg": [
"SELECT COUNT(DocumentNode) FROM Document WHERE DocumentSummary IS NULL",
"SELECT COUNT(T1.TransactionID) FROM TransactionHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Quantity BETWEEN 100 AND 250 AND T2.ReorderPoint <= 375",
"SELECT T1.LastReceiptCost - T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Freewheel'",
"SELECT T2.ProductID FROM ProductSubcategory AS T1 INNER JOIN Product AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID WHERE T1.Name = 'Socks'",
"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",
"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'",
"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'",
"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",
"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 )",
"SELECT ProductID FROM ProductListPriceHistory WHERE StartDate LIKE '2012%' ORDER BY ListPrice DESC LIMIT 1"
]
} |
{
"query": "Who made the purchase order with the greatest total due before freight? Indicate her employee ID and calculate for his/her age when he/she was hired.",
"pos": [
"SELECT T2.BusinessEntityID, STRFTIME('%Y', T2.HireDate) - STRFTIME('%Y', T2.BirthDate) FROM PurchaseOrderHeader AS T1 INNER JOIN Employee AS T2 ON T1.EmployeeID = T2.BusinessEntityID ORDER BY T1.TotalDue DESC LIMIT 1"
],
"neg": [
"SELECT FirstName, LastName FROM Person WHERE PersonType = 'EM' ORDER BY BusinessEntityID",
"SELECT T2.CreditRating FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.StandardPrice = 18.9900 AND T1.AverageLeadTime = 16 AND STRFTIME('%Y-%m-%d', T1.LastReceiptDate) = '2011-08-27'",
"SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277",
"SELECT ReviewerName FROM ProductReview WHERE Rating = 5",
"SELECT CAST(SUM(CASE WHEN T2.Gender = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessentityID) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessentityID = T2.BusinessentityID WHERE T1.PersonType = 'EM'",
"SELECT ProductID FROM ProductListPriceHistory WHERE StartDate LIKE '2012%' ORDER BY ListPrice DESC LIMIT 1",
"SELECT T1.FirstName, T2.BirthDate FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.BusinessEntityID = 18",
"SELECT T1.PreferredVendorStatus FROM Vendor AS T1 INNER JOIN BusinessEntity AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.rowguid = '684F328D-C185-43B9-AF9A-37ACC680D2AF'",
"SELECT SUM(T1.PerAssemblyQty), T2.Name FROM BillOfMaterials AS T1 INNER JOIN UnitMeasure AS T2 ON T1.UnitMeasureCode = T2.UnitMeasureCode WHERE T1.UnitMeasureCode IN ('EA', 'IN', 'OZ') GROUP BY T2.Name",
"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"
]
} |
{
"query": "Please list the top 3 discounts with the highest discount percentage and fall under the reseller category.",
"pos": [
"SELECT Description, DiscountPct FROM SpecialOffer WHERE Category = 'Reseller' ORDER BY DiscountPct DESC LIMIT 0, 3"
],
"neg": [
"SELECT TotalDue FROM PurchaseOrderHeader ORDER BY Freight DESC LIMIT 2, 1",
"SELECT CAST(SUM(ActualCost) AS REAL) / COUNT(TransactionID) FROM TransactionHistoryArchive WHERE TransactionType = 'P' AND TransactionDate >= '2012-01-01' AND TransactionDate < '2012-07-01'",
"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",
"SELECT ProductID FROM ProductCostHistory ORDER BY StandardCost ASC LIMIT 3",
"SELECT (T1.ListPrice - T2.StandardCost) * 100 / T2.StandardCost FROM ProductListPriceHistory AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 858",
"SELECT T2.City, T1.Name, T1.IsOnlyStateProvinceFlag FROM StateProvince AS T1 INNER JOIN Address AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.AddressID = 15873",
"SELECT Status FROM SalesOrderHeader ORDER BY Freight DESC LIMIT 1",
"SELECT TaxAmt, PurchaseOrderID FROM PurchaseOrderHeader ORDER BY TaxAmt DESC LIMIT 1",
"SELECT Name FROM Product ORDER BY ListPrice DESC LIMIT 5",
"SELECT T2.LastReceiptCost - T2.StandardPrice FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE '%Crankarm%'"
]
} |
{
"query": "Please list the top three employees with the most unused sick leave along with their position titles.",
"pos": [
"SELECT JobTitle FROM Employee ORDER BY SickLeaveHours DESC LIMIT 3"
],
"neg": [
"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",
"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'",
"SELECT COUNT(BusinessEntityID) FROM Employee WHERE MaritalStatus = 'M' AND STRFTIME('%Y', BirthDate) < '1960' AND Gender = 'M'",
"SELECT T2.BusinessEntityID FROM PhoneNumberType AS T1 INNER JOIN PersonPhone AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID WHERE T1.Name = 'Cell' LIMIT 3",
"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",
"SELECT T2.ProductID FROM ProductSubcategory AS T1 INNER JOIN Product AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID WHERE T1.Name = 'Socks'",
"SELECT T1.DaysToManufacture FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Rating = 5 AND T1.Class = 'M' ORDER BY T2.Rating LIMIT 1",
"SELECT DepartmentID FROM Department WHERE GroupName = 'Sales and Marketing'",
"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",
"SELECT COUNT(*) FROM BillOfMaterials WHERE BOMLevel = 2 AND EndDate IS NULL"
]
} |
{
"query": "Which job title has the lowest pay?",
"pos": [
"SELECT T1.JobTitle FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.Rate ASC LIMIT 1"
],
"neg": [
"SELECT T2.WorkOrderID FROM ScrapReason AS T1 INNER JOIN WorkOrder AS T2 ON T1.ScrapReasonID = T2.ScrapReasonID WHERE T1.Name = 'Handling damage'",
"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",
"SELECT CAST(SUM(CASE WHEN T2.VacationHours > 20 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.SickLeaveHours > 10",
"SELECT T2.StandardCost, T2.ProductNumber FROM ProductCostHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 888",
"SELECT T2.CreditRating FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.StandardPrice = 18.9900 AND T1.AverageLeadTime = 16 AND STRFTIME('%Y-%m-%d', T1.LastReceiptDate) = '2011-08-27'",
"SELECT CurrencyCode FROM Currency WHERE Name = 'Mauritius Rupee'",
"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'",
"SELECT Name FROM Vendor WHERE PreferredVendorStatus = 0 LIMIT 3",
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ProductLine = 'M' GROUP BY T2.Name ORDER BY CAST(SUM(T1.Rating) AS REAL) / COUNT(T1.ProductID) DESC LIMIT 1",
"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 )"
]
} |
{
"query": "What is the highest vendor's selling price for Hex Nut 5?",
"pos": [
"SELECT T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Hex Nut 5' ORDER BY T1.StandardPrice DESC LIMIT 1"
],
"neg": [
"SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SP'",
"SELECT T2.ProductID FROM ProductSubcategory AS T1 INNER JOIN Product AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID WHERE T1.Name = 'Socks'",
"SELECT SUM(FinishedGoodsFlag) FROM Product WHERE MakeFlag = 1",
"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'",
"SELECT BusinessEntityID FROM SalesPerson WHERE SalesYTD > SalesLastYear + SalesLastyear * 0.6 AND Bonus > 3000",
"SELECT COUNT(CardNumber) FROM CreditCard WHERE CardType = 'vista'",
"SELECT T2.WorkOrderID FROM ScrapReason AS T1 INNER JOIN WorkOrder AS T2 ON T1.ScrapReasonID = T2.ScrapReasonID WHERE T1.Name = 'Handling damage'",
"SELECT COUNT(T2.BusinessEntityID) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.BirthDate = '1975-12-25' AND T1.DocumentSummary IS NULL",
"SELECT Name FROM SalesTerritory WHERE CountryRegionCode = 'US' AND (Name = 'Northwest' OR Name = 'Southeast') ORDER BY SalesLastYear DESC LIMIT 1",
"SELECT BusinessEntityID FROM Vendor WHERE CreditRating = ( SELECT CreditRating FROM Vendor ORDER BY CreditRating DESC LIMIT 1 )"
]
} |
{
"query": "When did the company hired its first Accountant?",
"pos": [
"SELECT MIN(HireDate) FROM Employee WHERE JobTitle = 'Accountant'"
],
"neg": [
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 1 GROUP BY T2.Name ORDER BY SUM(T1.Rating) DESC LIMIT 1",
"SELECT Name FROM SalesTerritory WHERE CountryRegionCode = 'US' AND (Name = 'Northwest' OR Name = 'Southeast') ORDER BY SalesLastYear DESC LIMIT 1",
"SELECT CAST(SUM(CASE WHEN T1.DocumentSummary IS NOT NULL THEN 1 ELSE 0 END) AS REAL) / COUNT(T1.DocumentSummary) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.HireDate = '2009-01-22'",
"SELECT Name FROM Product ORDER BY ListPrice DESC LIMIT 5",
"SELECT (T2.ListPrice - T2.StandardCost) * SUM(T1.Quantity), T2.Name FROM ShoppingCartItem AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID, T2.Name, T2.ListPrice, T2.StandardCost, T1.Quantity ORDER BY SUM(T1.Quantity) DESC LIMIT 1",
"SELECT SafetyStockLevel FROM Product WHERE Name = 'Chainring Bolts'",
"SELECT Type FROM SpecialOffer WHERE Category = 'Reseller'",
"SELECT T3.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 T2.Name = 'Hex Nut 5' ORDER BY T1.StandardPrice LIMIT 1",
"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",
"SELECT T2.FirstName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.MaritalStatus = 'S' AND T1.Gender = 'M' AND T1.JobTitle LIKE 'Production Supervisor%'"
]
} |
{
"query": "Please list the email adresses of the reviewers who have given the lowest rating to the product HL Mountain Pedal.",
"pos": [
"SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Mountain Pedal' ORDER BY T1.Rating LIMIT 1"
],
"neg": [
"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'",
"SELECT Title FROM Document WHERE Status = 1",
"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",
"SELECT Description FROM SpecialOffer WHERE Type = 'Seasonal Discount' ORDER BY DiscountPct DESC LIMIT 1",
"SELECT COUNT(OrderQty) FROM SalesOrderDetail WHERE ProductID IN ( SELECT ProductID FROM Product WHERE Name = 'Minipump' )",
"SELECT SafetyStockLevel FROM Product WHERE Name = 'Chainring Bolts'",
"SELECT FirstName, LastName FROM Person WHERE PersonType = 'EM' ORDER BY BusinessEntityID",
"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",
"SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID IN ( SELECT AddressID FROM BusinessEntityAddress WHERE BusinessEntityID = 4 )",
"SELECT T2.BusinessEntityID, STRFTIME('%Y', T2.HireDate) - STRFTIME('%Y', T2.BirthDate) FROM PurchaseOrderHeader AS T1 INNER JOIN Employee AS T2 ON T1.EmployeeID = T2.BusinessEntityID ORDER BY T1.TotalDue DESC LIMIT 1"
]
} |
{
"query": "What is the shipping address for the sales order \"43873\"?",
"pos": [
"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"
],
"neg": [
"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",
"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 )",
"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",
"SELECT COUNT(BusinessEntityID) FROM Person WHERE PersonType = 'SC' AND Title = 'Mr.'",
"SELECT COUNT(T1.TransactionID) FROM TransactionHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Quantity BETWEEN 100 AND 250 AND T2.ReorderPoint <= 375",
"SELECT COUNT(T1.BusinessentityID) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'EM' AND T2.MaritalStatus = 'S'",
"SELECT CASE WHEN ActualCost = PlannedCost THEN 'No' ELSE 'Yes' END FROM WorkOrderRouting",
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 1 GROUP BY T2.Name ORDER BY SUM(T1.Rating) DESC LIMIT 1",
"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'",
"SELECT Status FROM SalesOrderHeader ORDER BY Freight DESC LIMIT 1"
]
} |
{
"query": "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.",
"pos": [
"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'"
],
"neg": [
"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",
"SELECT DepartmentID FROM Department WHERE GroupName = 'Sales and Marketing'",
"SELECT T1.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ListPrice - T1.StandardCost > 21.9037 AND STRFTIME('%Y-%m-%d', T2.StartDate) >= '2012-10-01'",
"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",
"SELECT T2.GroupName FROM EmployeeDepartmentHistory AS T1 INNER JOIN Department AS T2 ON T1.DepartmentID = T2.DepartmentID GROUP BY T2.GroupName ORDER BY COUNT(T1.BusinessEntityID) LIMIT 1",
"SELECT T2.PersonType FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.BirthDate ASC LIMIT 1",
"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",
"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",
"SELECT COUNT(CreditCardID) FROM CreditCard WHERE CardType = 'Vista' AND ExpYear < 2007",
"SELECT T2.WorkOrderID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'"
]
} |
{
"query": "If a married employee has a western name style, what is the probability of him or her working as a store contact?",
"pos": [
"SELECT CAST(COUNT(IIF(T1.PersonType = 'SC', T1.PersonType, NULL)) AS REAL) / COUNT(T1.PersonType) FROM Person AS T1 INNER JOIN Employee AS T2 WHERE T1.PersonType = 'SC' AND T1.NameStyle = 0 AND T2.MaritalStatus = 'M'"
],
"neg": [
"SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Mountain Pedal' ORDER BY T1.Rating LIMIT 1",
"SELECT SUM(CASE WHEN T2.ProductLine = 'M' THEN 1 ELSE 0 END) FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID HAVING COUNT(T1.ProductReviewID) > 1",
"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 )",
"SELECT T2.StandardCost, T2.ProductNumber FROM ProductCostHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 888",
"SELECT BusinessEntityID FROM Person WHERE Title = 'Mr.' AND FirstName = 'Hung-Fu' AND LastName = 'Ting'",
"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 )",
"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",
"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'",
"SELECT T1.ReviewerName FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'M' AND T2.Style = 'W' AND T1.Rating = 5",
"SELECT T1.FirstName, T2.BirthDate FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.BusinessEntityID = 18"
]
} |
{
"query": "Compare the average pay rate of male and female employees.",
"pos": [
"SELECT AVG(T2.Rate) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID GROUP BY T1.Gender"
],
"neg": [
"SELECT T2.StandardCost, T2.ProductNumber FROM ProductCostHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 888",
"SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277",
"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",
"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'",
"SELECT JobTitle FROM Employee ORDER BY SickLeaveHours DESC LIMIT 3",
"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'",
"SELECT DISTINCT T1.Name, T1.ListPrice FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 10000",
"SELECT T1.ProductModelID FROM ProductModelProductDescriptionCulture AS T1 INNER JOIN Culture AS T2 USING (cultureid) INNER JOIN ProductDescription AS T3 USING (productdescriptionid) WHERE T3.Description LIKE 'Chromoly steel%' AND T2.Name = 'English'",
"SELECT T1.PreferredVendorStatus FROM Vendor AS T1 INNER JOIN BusinessEntity AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.rowguid = '684F328D-C185-43B9-AF9A-37ACC680D2AF'",
"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'"
]
} |
{
"query": "Between Northwest and Southeast of the United States, which territory one recorded the highest amount of sales last year?",
"pos": [
"SELECT Name FROM SalesTerritory WHERE CountryRegionCode = 'US' AND (Name = 'Northwest' OR Name = 'Southeast') ORDER BY SalesLastYear DESC LIMIT 1"
],
"neg": [
"SELECT T2.PayFrequency FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.SickLeaveHours ASC LIMIT 1",
"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",
"SELECT T2.Name FROM ProductListPriceHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T2.Name ORDER BY COUNT(T1.ListPrice) > 3",
"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 )",
"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",
"SELECT TaxAmt, PurchaseOrderID FROM PurchaseOrderHeader ORDER BY TaxAmt DESC LIMIT 1",
"SELECT Weight FROM Product WHERE WeightUnitMeasureCode = 'LB' GROUP BY Weight ORDER BY COUNT(Style) DESC LIMIT 1",
"SELECT T1.FirstName, T2.BirthDate FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.BusinessEntityID = 18",
"SELECT T1.Name, T2.ReviewerName, T2.Rating, T2.Comments FROM Product AS T1 INNER JOIN ProductReview AS T2 USING (productID) WHERE T1.ProductLine = 'R'",
"SELECT COUNT(BusinessEntityID) FROM SalesPerson WHERE Bonus = 0"
]
} |
{
"query": "Please list the total number of companies with a commission percentage of 0.018 or above, along with each company's assigned geographical location.",
"pos": [
"SELECT T1.BusinessEntityID, T2.'Group' FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 USING (territoryid) WHERE T1.CommissionPct >= 0.018"
],
"neg": [
"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",
"SELECT CAST(SUM(CASE WHEN T1.DocumentSummary IS NOT NULL THEN 1 ELSE 0 END) AS REAL) / COUNT(T1.DocumentSummary) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.HireDate = '2009-01-22'",
"SELECT COUNT(SalesTaxRateID) FROM SalesTaxRate WHERE Name LIKE '%+%'",
"SELECT COUNT(*) FROM ProductCategory AS T1 INNER JOIN ProductSubcategory AS T2 ON T1.ProductCategoryID = T2.ProductCategoryID WHERE T1.Name = 'Bikes'",
"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'",
"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",
"SELECT CardNumber FROM CreditCard WHERE ExpYear < 2007",
"SELECT COUNT(T2.CustomerID) FROM SalesTerritory AS T1 INNER JOIN Customer AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.Name = 'Canada'",
"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)",
"SELECT T1.FirstName, T1.LastName FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.MaritalStatus = 'M' AND T2.VacationHours < 20"
]
} |
{
"query": "What is the thumbnail photo file for the product with the id \"979\"?",
"pos": [
"SELECT T2.ThumbnailPhotoFileName FROM ProductProductPhoto AS T1 INNER JOIN ProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.ProductID = 979"
],
"neg": [
"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'",
"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%' )",
"SELECT T1.FirstName, T1.LastName FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.MaritalStatus = 'M' AND T2.VacationHours < 20",
"SELECT T2.CreditRating FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.StandardPrice = 18.9900 AND T1.AverageLeadTime = 16 AND STRFTIME('%Y-%m-%d', T1.LastReceiptDate) = '2011-08-27'",
"SELECT SUM(T2.OrderQty) FROM PurchaseOrderHeader AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.PurchaseOrderID = T2.PurchaseOrderID WHERE T1.Status = 1",
"SELECT T1.CountryRegionCode FROM StateProvince AS T1 INNER JOIN CountryRegion AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode WHERE T2.Name = 'France' AND T1.IsOnlyStateProvinceFlag = 1",
"SELECT T2.Shelf FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'",
"SELECT SUM(Quantity) FROM TransactionHistory WHERE TransactionDate LIKE '2013-08%' AND TransactionType = 'S' AND ProductID = 989",
"SELECT BusinessEntityID FROM SalesPerson ORDER BY SalesYTD DESC LIMIT 1",
"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'"
]
} |
{
"query": "What is the forename and birthdate of person number 18?",
"pos": [
"SELECT T1.FirstName, T2.BirthDate FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.BusinessEntityID = 18"
],
"neg": [
"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'",
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1",
"SELECT COUNT(T2.ProductID) FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.OnOrderQty IS NULL OR T1.OnOrderQty = 0",
"SELECT TaxAmt, PurchaseOrderID FROM PurchaseOrderHeader ORDER BY TaxAmt DESC LIMIT 1",
"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",
"SELECT COUNT(*) FROM ProductCategory AS T1 INNER JOIN ProductSubcategory AS T2 ON T1.ProductCategoryID = T2.ProductCategoryID WHERE T1.Name = 'Bikes'",
"SELECT COUNT(BusinessEntityID) FROM SalesPerson WHERE Bonus = 0",
"SELECT T1.JobTitle, T2.FirstName, T2.MiddleName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.HireDate LIMIT 1",
"SELECT T1.BusinessEntityID, T2.'Group' FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 USING (territoryid) WHERE T1.CommissionPct >= 0.018",
"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"
]
} |
{
"query": "What category do Road Frames fall into?",
"pos": [
"SELECT T2.Name FROM ProductSubcategory AS T1 INNER JOIN ProductCategory AS T2 ON T1.ProductCategoryID = T2.ProductCategoryID WHERE T1.Name = 'Road Frames'"
],
"neg": [
"SELECT T2.City, T1.Name, T1.IsOnlyStateProvinceFlag FROM StateProvince AS T1 INNER JOIN Address AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.AddressID = 15873",
"SELECT COUNT(T1.BusinessentityID) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'EM' AND T2.MaritalStatus = 'S'",
"SELECT T2.Name FROM ProductListPriceHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T2.Name ORDER BY COUNT(T1.ListPrice) > 3",
"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'",
"SELECT SUM(CASE WHEN T1.ProductLine = 'M' THEN 1 ELSE 0 END) FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID GROUP BY T1.ProductID HAVING COUNT(T1.Name) > 2",
"SELECT COUNT(BusinessEntityID) FROM Person WHERE PersonType = 'SC' AND Title = 'Mr.'",
"SELECT CAST(SUM(CASE WHEN T2.VacationHours > 20 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.SickLeaveHours > 10",
"SELECT Name, ListPrice FROM Product WHERE Class = 'H'",
"SELECT T1.ReviewerName FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'M' AND T2.Style = 'W' AND T1.Rating = 5",
"SELECT DISTINCT Name FROM Product WHERE ListPrice - StandardCost > 100"
]
} |
{
"query": "List all products with minimum order quantity of 100 and order them by product name in descending order.",
"pos": [
"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"
],
"neg": [
"SELECT T2.WorkOrderID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'",
"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'",
"SELECT AVG(T2.StandardCost) FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductNumber = 'CA-1098'",
"SELECT COUNT(CreditCardID) FROM CreditCard WHERE CardType = 'Vista' AND ExpYear < 2007",
"SELECT T1.TransactionType FROM TransactionHistoryArchive AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'LL Road Handlebars' AND STRFTIME('%Y-%m-%d',T1.TransactionDate) = '2012-11-03'",
"SELECT ReviewerName FROM ProductReview WHERE Rating = ( SELECT Rating FROM ProductReview ORDER BY Rating DESC LIMIT 1 )",
"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",
"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'",
"SELECT SUM(T1.ListPrice - T1.StandardCost) / COUNT(T1.ProductID) 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'",
"SELECT COUNT(BusinessEntityID) FROM SalesPerson WHERE Bonus = 0"
]
} |
{
"query": "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?",
"pos": [
"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'"
],
"neg": [
"SELECT SUM(CASE WHEN T2.Name = 'Home' THEN 1 ELSE 0 END) , SUM(CASE WHEN T2.Name = 'Shipping' THEN 1 ELSE 0 END) FROM BusinessEntityAddress AS T1 INNER JOIN AddressType AS T2 ON T1.AddressTypeID = T2.AddressTypeID",
"SELECT AVG(T2.StandardCost) FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductNumber = 'CA-1098'",
"SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID IN ( SELECT AddressID FROM BusinessEntityAddress WHERE BusinessEntityID = 4 )",
"SELECT COUNT(T2.ProductID) FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.OnOrderQty IS NULL OR T1.OnOrderQty = 0",
"SELECT Description FROM SpecialOffer WHERE Type = 'Seasonal Discount' ORDER BY DiscountPct DESC LIMIT 1",
"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",
"SELECT T2.Name FROM ProductListPriceHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T2.Name ORDER BY COUNT(T1.ListPrice) > 3",
"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'",
"SELECT T2.StandardCost, T2.ProductNumber FROM ProductCostHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 888",
"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'"
]
} |
{
"query": "What is the average profit of all the products from the Clothing category?",
"pos": [
"SELECT SUM(T1.ListPrice - T1.StandardCost) / COUNT(T1.ProductID) 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'"
],
"neg": [
"SELECT COUNT(*) FROM WorkOrderRouting AS T1 INNER JOIN BillOfMaterials AS T2 ON T1.LocationID = T2.ProductAssemblyID INNER JOIN WorkOrder AS T3 ON T3.WorkOrderID = T1.WorkOrderID WHERE T1.LocationID = 40",
"SELECT MAX(T1.Rate) - SUM(T1.Rate) / COUNT(T1.BusinessEntityID) 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 T2.EmailPromotion = 2 AND T3.MaritalStatus = 'M'",
"SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277",
"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",
"SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Mountain Pedal' ORDER BY T1.Rating LIMIT 1",
"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'",
"SELECT T2.BusinessEntityID FROM PhoneNumberType AS T1 INNER JOIN PersonPhone AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID WHERE T1.Name = 'Cell' LIMIT 3",
"SELECT T2.OrderQty - T2.ReceivedQty, VendorID FROM PurchaseOrderHeader AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.PurchaseOrderID = T2.PurchaseOrderID ORDER BY T2.OrderQty - T2.ReceivedQty DESC LIMIT 1",
"SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1",
"SELECT Status FROM SalesOrderHeader ORDER BY Freight DESC LIMIT 1"
]
} |
{
"query": "How many products are there if we add all those located in the Subassembly category?",
"pos": [
"SELECT COUNT(T1.LocationID) FROM Location AS T1 INNER JOIN ProductInventory AS T2 USING (LocationID) WHERE T1.Name = 'Subassembly'"
],
"neg": [
"SELECT SUM(T2.OrderQty) FROM PurchaseOrderHeader AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.PurchaseOrderID = T2.PurchaseOrderID WHERE T1.Status = 1",
"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",
"SELECT JobTitle FROM Employee ORDER BY SickLeaveHours DESC LIMIT 3",
"SELECT COUNT(T1.TransactionID) FROM TransactionHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Quantity BETWEEN 100 AND 250 AND T2.ReorderPoint <= 375",
"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'",
"SELECT SUM(CASE WHEN T1.ProductLine = 'M' THEN 1 ELSE 0 END) FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID GROUP BY T1.ProductID HAVING COUNT(T1.Name) > 2",
"SELECT T1.ReviewerName FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'M' AND T2.Style = 'W' AND T1.Rating = 5",
"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",
"SELECT TransactionID FROM TransactionHistory WHERE TransactionType = 'W' ORDER BY Quantity DESC LIMIT 1",
"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"
]
} |
{
"query": "What's the profit for the Freewheel?",
"pos": [
"SELECT T1.LastReceiptCost - T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Freewheel'"
],
"neg": [
"SELECT CAST(SUM(CASE WHEN JobTitle = 'Sales Representative' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(BusinessEntityID) FROM Employee",
"SELECT DepartmentID FROM Department WHERE GroupName = 'Sales and Marketing'",
"SELECT T2.Class FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T2.Class ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1",
"SELECT Title FROM Document WHERE Status = 1",
"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",
"SELECT ListPrice - StandardCost FROM Product WHERE ProductID = 740",
"SELECT COUNT(T2.CustomerID) FROM SalesTerritory AS T1 INNER JOIN Customer AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.Name = 'Canada'",
"SELECT CAST(SUM(CASE WHEN T2.VacationHours > 20 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.SickLeaveHours > 10",
"SELECT COUNT(*) FROM WorkOrderRouting AS T1 INNER JOIN BillOfMaterials AS T2 ON T1.LocationID = T2.ProductAssemblyID INNER JOIN WorkOrder AS T3 ON T3.WorkOrderID = T1.WorkOrderID WHERE T1.LocationID = 40",
"SELECT T2.StandardCost FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE '%Sport%'"
]
} |
{
"query": "What is the percentage, by number of sales order units, for orders with quantities not greater than 3 and a discount of 0.2?",
"pos": [
"SELECT CAST(SUM(CASE WHEN OrderQty < 3 AND UnitPriceDiscount = 0.2 THEN 1 ELSE 0 END) AS REAL) / COUNT(SalesOrderID) FROM SalesOrderDetail"
],
"neg": [
"SELECT SUM(T1.StandardPrice) / COUNT(T1.BusinessEntityID) FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Hex Nut 5'",
"SELECT SUM(T1.SickLeaveHours) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 0",
"SELECT CAST(COUNT(IIF(T1.PersonType = 'SC', T1.PersonType, NULL)) AS REAL) / COUNT(T1.PersonType) FROM Person AS T1 INNER JOIN Employee AS T2 WHERE T1.PersonType = 'SC' AND T1.NameStyle = 0 AND T2.MaritalStatus = 'M'",
"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",
"SELECT T1.ProductModelID FROM ProductModelProductDescriptionCulture AS T1 INNER JOIN Culture AS T2 USING (cultureid) INNER JOIN ProductDescription AS T3 USING (productdescriptionid) WHERE T3.Description LIKE 'Chromoly steel%' AND T2.Name = 'English'",
"SELECT T1.JobTitle FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.Rate ASC LIMIT 1",
"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'",
"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'",
"SELECT T1.AverageLeadTime, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 USING (businessentityid) WHERE T2.BusinessEntityID = 1496 GROUP BY T1.AverageLeadTime, T2.Name",
"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 )"
]
} |
{
"query": "What are the names of the product that has the lowest rating?",
"pos": [
"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 )"
],
"neg": [
"SELECT T2.City, T1.Name, T1.IsOnlyStateProvinceFlag FROM StateProvince AS T1 INNER JOIN Address AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.AddressID = 15873",
"SELECT COUNT(DISTINCT T1.Name) FROM SalesTaxRate AS T1 INNER JOIN StateProvince AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.Name = 'Quebec'",
"SELECT COUNT(T2.CustomerID) FROM SalesTerritory AS T1 INNER JOIN Customer AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.Name = 'Canada'",
"SELECT ProductID FROM ProductCostHistory ORDER BY StandardCost ASC LIMIT 3",
"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",
"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'",
"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",
"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'",
"SELECT CAST(SUM(CASE WHEN JobTitle = 'Sales Representative' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(BusinessEntityID) FROM Employee",
"SELECT T1.ListPrice - T2.StandardCost FROM ProductListPriceHistory AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 792"
]
} |
{
"query": "How many employees with a pay rate of over 35 have more than 10 sick leave hours?",
"pos": [
"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"
],
"neg": [
"SELECT BusinessEntityID FROM Vendor WHERE CreditRating = ( SELECT CreditRating FROM Vendor ORDER BY CreditRating DESC LIMIT 1 )",
"SELECT T2.LocationID, T2.Shelf, T2.Bin FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE 'Lock Ring'",
"SELECT COUNT(DISTINCT T1.ProductID) FROM SalesOrderDetail AS T1 INNER JOIN SpecialOfferProduct AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID INNER JOIN SpecialOffer AS T3 ON T2.SpecialOfferID = T3.SpecialOfferID WHERE T1.OrderQty > 2 AND T1.UnitPriceDiscount = 0",
"SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.Gender = 'M' AND T1.PayFrequency = 2",
"SELECT Name FROM Product ORDER BY ListPrice DESC LIMIT 5",
"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'",
"SELECT Weight FROM Product WHERE WeightUnitMeasureCode = 'LB' GROUP BY Weight ORDER BY COUNT(Style) DESC LIMIT 1",
"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'",
"SELECT T2.BusinessEntityID, STRFTIME('%Y', T2.HireDate) - STRFTIME('%Y', T2.BirthDate) FROM PurchaseOrderHeader AS T1 INNER JOIN Employee AS T2 ON T1.EmployeeID = T2.BusinessEntityID ORDER BY T1.TotalDue DESC LIMIT 1",
"SELECT 10 * (ListPrice - StandardCost) FROM Product WHERE Weight IS NOT NULL ORDER BY Weight LIMIT 1"
]
} |
{
"query": "Calculate the average age of employee in each department and state which department has the youngest employees.",
"pos": [
"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"
],
"neg": [
"SELECT ProductID FROM ProductCostHistory ORDER BY StandardCost ASC LIMIT 3",
"SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 0 AND (T1.OnOrderQty IS NULL OR T1.OnOrderQty = 0)",
"SELECT LENGTH(T2.PasswordHash) FROM Person AS T1 INNER JOIN Password AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Catherine' AND T1.LastName = 'Ward'",
"SELECT AVG(T2.StandardCost) FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductNumber = 'CA-1098'",
"SELECT T2.Name FROM ProductSubcategory AS T1 INNER JOIN ProductCategory AS T2 ON T1.ProductCategoryID = T2.ProductCategoryID WHERE T1.Name = 'Road Frames'",
"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",
"SELECT T3.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 T2.Name = 'Hex Nut 5' ORDER BY T1.StandardPrice LIMIT 1",
"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)",
"SELECT COUNT(DISTINCT T2.ProductID) FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName = 'roadster_black_large.gif'",
"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"
]
} |
{
"query": "Which geographic area does the city with the second lowest tax rate belongs to? Indicate the name of the state or province as well.",
"pos": [
"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"
],
"neg": [
"SELECT CAST(COUNT(IIF(T1.PersonType = 'SC', T1.PersonType, NULL)) AS REAL) / COUNT(T1.PersonType) FROM Person AS T1 INNER JOIN Employee AS T2 WHERE T1.PersonType = 'SC' AND T1.NameStyle = 0 AND T2.MaritalStatus = 'M'",
"SELECT COUNT(BusinessEntityID) FROM SalesPerson WHERE Bonus = 0",
"SELECT T1.FirstName, T1.LastName FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.MaritalStatus = 'M' AND T2.VacationHours < 20",
"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",
"SELECT T3.PurchasingWebServiceURL 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 T2.Name = 'Hex Nut 5'",
"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'",
"SELECT TaxAmt, PurchaseOrderID FROM PurchaseOrderHeader ORDER BY TaxAmt DESC LIMIT 1",
"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",
"SELECT T1.AverageLeadTime, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 USING (businessentityid) WHERE T2.BusinessEntityID = 1496 GROUP BY T1.AverageLeadTime, T2.Name",
"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'"
]
} |
{
"query": "Among the employees whose pay frequencies are the highest, how many of them are married?",
"pos": [
"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 )"
],
"neg": [
"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",
"SELECT T1.BusinessEntityID, T2.'Group' FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 USING (territoryid) WHERE T1.CommissionPct >= 0.018",
"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'",
"SELECT T2.LastReceiptCost - T2.StandardPrice FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE '%Crankarm%'",
"SELECT Title FROM Document WHERE Status = 1",
"SELECT COUNT(T2.BusinessEntityID) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.BirthDate = '1975-12-25' AND T1.DocumentSummary IS NULL",
"SELECT CAST(SUM(CASE WHEN JobTitle = 'Sales Representative' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(BusinessEntityID) FROM Employee",
"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'",
"SELECT BusinessEntityID FROM SalesPerson ORDER BY SalesYTD DESC LIMIT 1",
"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"
]
} |
{
"query": "What is business number 1580's net profit?",
"pos": [
"SELECT LastReceiptCost - StandardPrice FROM ProductVendor WHERE BusinessEntityID = 1580"
],
"neg": [
"SELECT T1.AverageLeadTime, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 USING (businessentityid) WHERE T2.BusinessEntityID = 1496 GROUP BY T1.AverageLeadTime, T2.Name",
"SELECT T2.Name FROM SalesOrderHeaderSalesReason AS T1 INNER JOIN SalesReason AS T2 ON T1.SalesReasonID = T2.SalesReasonID WHERE T1.SalesOrderID = 43718",
"SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'H'",
"SELECT T1.DaysToManufacture FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Rating = 5 AND T1.Class = 'M' ORDER BY T2.Rating LIMIT 1",
"SELECT AVG(T2.StandardCost) FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductNumber = 'CA-1098'",
"SELECT COUNT(T2.CustomerID) FROM SalesTerritory AS T1 INNER JOIN Customer AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.Name = 'Canada'",
"SELECT ReviewerName FROM ProductReview WHERE Rating = 5",
"SELECT COUNT(*) FROM BillOfMaterials WHERE BOMLevel = 2 AND EndDate IS NULL",
"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'",
"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"
]
} |