db_id
stringclasses
69 values
question
stringlengths
24
325
evidence
stringlengths
0
673
SQL
stringlengths
23
804
question_id
int64
0
9.43k
difficulty
stringclasses
1 value
works_cycles
Please list the top 3 discounts with the highest discount percentage and fall under the reseller category.
discount percentage refers to DiscountPct; highest discount percentage refers to MAX(DiscountPct);
SELECT Description, DiscountPct FROM SpecialOffer WHERE Category = 'Reseller' ORDER BY DiscountPct DESC LIMIT 0, 3
7,400
works_cycles
Where can I get the demographic information about the Valley Bicycle Specialists store?
Valley Bicycle Specialists is a name of a store;
SELECT Demographics FROM Store WHERE Name = 'Valley Bicycle Specialists'
7,401
works_cycles
Among all the products that are manufactured in-house, how many of them are salable?
product is mnanufactured in-house refers to MakeFlag = 1; salable product refers to FinishedGoodsFlag = 1;
SELECT SUM(FinishedGoodsFlag) FROM Product WHERE MakeFlag = 1
7,402
works_cycles
What is the minimum inventory quantity of Chainring Bolts?
minimum inventory quantity refers to SafetyStockLevel; chainring bolts is a name of product;
SELECT SafetyStockLevel FROM Product WHERE Name = 'Chainring Bolts'
7,403
works_cycles
Which product has the highest standard cost?
SELECT Name FROM Product ORDER BY StandardCost DESC LIMIT 1
7,404
works_cycles
What type of employee is David Bradley?
type of employee refers to PersonType;
SELECT PersonType FROM Person WHERE FirstName = 'David' AND LastName = 'Bradley'
7,405
works_cycles
Among the employees who are store contacts, how many of them have a title of "Mr."?
store contact refers to PersonType = 'SC';
SELECT COUNT(BusinessEntityID) FROM Person WHERE PersonType = 'SC' AND Title = 'Mr.'
7,406
works_cycles
Where can I find the Valley Bicycle Specialists store?
Valley Bicycle Specialists is a name of store; full address = AddressLine1+AddressLine2;
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'
7,407
works_cycles
To which e-mail address should I write if I want to contact David Bradley?
SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'David' AND T1.LastName = 'Bradley'
7,408
works_cycles
Please list the phone numbers of all the store contacts.
store contact refers to PersonType = 'SC';
SELECT T2.PhoneNumber FROM Person AS T1 INNER JOIN PersonPhone AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SC'
7,409
works_cycles
What is the hashed password of David Bradley?
hashed password refers to PasswordHash;
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'
7,410
works_cycles
Please list the e-mail addresses of all the employees who wish to receive e-mail promotions from Adventureworks and selected partners.
employees who wish to receive e-mail promotions from AdventureWorks and selected partners refers to EmailPromotion = 2;
SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.EmailPromotion = 2
7,411
works_cycles
Please show the credit card number of David Bradley.
credit card number refers to CardNumber;
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'
7,412
works_cycles
In which year will the David Bradley's credit card expire?
year of credit card expiration refers to ExpYear;
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'
7,413
works_cycles
Please list the names of all the store contact employees whose credit cards expired in 2007.
year of credit card expiration refers to ExpYear; ExpYear = 2007; store contact refers to PersonType = 'SC';
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'
7,414
works_cycles
Among the store contact employees, how many of them have a Vista credit card?
store contact refers to PersonType = 'SC'; type of credit card refers to CardType; CardType = 'vista';
SELECT COUNT(T1.FirstName) FROM Person AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN CreditCard AS T3 ON T2.CreditCardID = T3.CreditCardID WHERE T3.CardType = 'Vista' AND T1.PersonType = 'SC'
7,415
works_cycles
How many departments have David Bradley been in?
SELECT COUNT(T3.DepartmentID) FROM Person AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Department AS T3 ON T2.DepartmentID = T3.DepartmentID WHERE T1.FirstName = 'David' AND T1.LastName = 'Bradley'
7,416
works_cycles
Please list the departments that David Bradley used to belong to.
SELECT T2.DepartmentID FROM Person AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Department AS T3 ON T2.DepartmentID = T3.DepartmentID WHERE T1.FirstName = 'David' AND T1.LastName = 'Bradley'
7,417
works_cycles
How many people were there in the Engineering Department in the year 2009?
year(EndDate)>2009 and year(StartDate)<2009;
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'
7,418
works_cycles
Which employee has been in the Engineering Department the longest? Please give his or her firstname and lastname.
length of stay in a department = SUBTRACT(EndDate, StartDate);
SELECT T1.FirstName, T1.LastName FROM Person AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Department AS T3 ON T2.DepartmentID = T3.DepartmentID WHERE T3.Name = 'Engineering' ORDER BY T2.EndDate - T2.StartDate DESC LIMIT 1
7,419
works_cycles
Among the employees in the Manufacturing group in 2007, how many of them are store contacts?
store contact refers to PersonType = 'SC'; year(EndDate)>2007 and year(StartDate)<2007;
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'
7,420
works_cycles
Please list the credit card numbers of all the employees who have left the Finance Department.
credit card number refers to CardNumber; employees who left the department refers to EndDate NOT null; Engineering Department is a name of department;
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
7,421
works_cycles
How many employees working in the Engineering Department in 2007 would have their credit cards expired in the same year?
year(StartDate) 2007; year of credit card expiration refers to ExpYear; ExpYear = 2007;
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'
7,422
works_cycles
What is the e-mail address of the employee who switched departments for the most times?
switched department the most refers to MAX(count(DepartmentID));
SELECT T2.EmailAddress FROM EmployeeDepartmentHistory AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID GROUP BY T2.BusinessEntityID ORDER BY COUNT(T1.DepartmentID) DESC LIMIT 1
7,423
works_cycles
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?
Employees who don't wish to receive e-mail promotions refers to EmailPromotion = 0;
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
7,424
works_cycles
How many employees came into the Quality Assurance Group in the year 2007?
Quality Assurance Group is a group name of department; came in 2007 refers to year(StartDate) = 2007;
SELECT COUNT(T1.BusinessEntityID) FROM EmployeeDepartmentHistory AS T1 INNER JOIN Department AS T2 ON T1.DepartmentID = T2.DepartmentID WHERE T2.GroupName = 'Quality Assurance' AND STRFTIME('%Y', T1.StartDate) = '2007'
7,425
works_cycles
Please list the product names of all the products on the LL Road Frame Sale.
LL Road Frame Sale is a description of special offer
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'
7,426
works_cycles
How many products were on the LL Road Frame Sale?
LL Road Frame Sale is a description of special offer
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'
7,427
works_cycles
Has the product Chainring Bolts been on any of the sales?
a product that's been on sale refers to SellStartDate NOT null and vice versa;
SELECT CASE WHEN COUNT(T1.Description) >= 1 THEN 'Yes' ELSE 'No' END FROM SpecialOffer AS T1 INNER JOIN SpecialOfferProduct AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID INNER JOIN Product AS T3 ON T2.ProductID = T3.ProductID WHERE T3.Name = 'Chainring Bolts'
7,428
works_cycles
How many products from the Clothing category were on the LL Road Frame Sale?
LL Road Frame Sale is a description of special offer
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'
7,429
works_cycles
Please list the products that are under the Clothing category that are manufactured in-house and salable.
product is manufactured in-house refers to MakeFlag = 1; salable product refers to FinishedGoodsFlag = 1;
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
7,430
works_cycles
For all the employees that have left the Engineering Department, what is the average time of their stay?
employees who left a department refers to EndDate NOT null; average stay = AVG(SUBTRACT(year(EndDate)), (year(T1.StartDate)));
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
7,431
works_cycles
What is the average pay rate of the employees who worked in the Engineering Departmentin 2007?
average pay rate = AVG(Rate); work in 2007 refers to year(StartDate)<2007 AND year(EndDate)>2007;
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'
7,432
works_cycles
How much more expensive in percentage is the product with the highest selling price from the product with the lowest selling price in the Clothing category?
selling price refers to ListPrice; highest selling price refers to MAX(ListPrice); lowest selling price refers to MIN(ListPrice);
SELECT (MAX(T1.ListPrice) - MIN(T1.ListPrice)) * 100 / MIN(T1.ListPrice) FROM Product AS T1 INNER JOIN ProductSubcategory AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID INNER JOIN ProductCategory AS T3 ON T2.ProductCategoryID = T3.ProductCategoryID WHERE T3.Name = 'Clothing'
7,433
works_cycles
What is the average profit of all the products from the Clothing category?
average profit = DIVIDE(SUM(SUBTRACT(ListPrice, StandardCost))), (COUNT(ProductSubcategoryID))));
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'
7,434
works_cycles
Which product cost the least in 2013?
cost refers to StandardCost; cost the least refers to MIN(StandardCost);
SELECT ProductID FROM ProductCostHistory WHERE StartDate LIKE '2013%' ORDER BY StandardCost LIMIT 1
7,435
works_cycles
List all products with the color yellow.
SELECT ProductID FROM Product WHERE Color = 'Yellow'
7,436
works_cycles
What is the bussiness id for Mr. Hung-Fu Ting?
business id refers to BusinessEntityID;
SELECT BusinessEntityID FROM Person WHERE Title = 'Mr.' AND FirstName = 'Hung-Fu' AND LastName = 'Ting'
7,437
works_cycles
What is the phone number of the person with id "12597"?
person with id refers to BusinessEntityID;
SELECT PhoneNumber FROM PersonPhone WHERE BusinessEntityID = 12597
7,438
works_cycles
What is the price for the product with the id "912"?
price refers to ListPrice;
SELECT ListPrice FROM ProductListPriceHistory WHERE ProductID = 912
7,439
works_cycles
Is there a work order where the planned cost is different from the actual cost?
planned cost is different from actual cost refers to ActualCost ! = PlannedCost;
SELECT CASE WHEN ActualCost = PlannedCost THEN 'No' ELSE 'Yes' END FROM WorkOrderRouting
7,440
works_cycles
What is the thumbnail photo file for the product with the id "979"?
thumbnail photo file refers to ThumbnailPhotoFileName;
SELECT T2.ThumbnailPhotoFileName FROM ProductProductPhoto AS T1 INNER JOIN ProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.ProductID = 979
7,441
works_cycles
List all the names of the products with the price of more than 1000$.
ListPrice>1000;
SELECT DISTINCT T2.Name FROM ProductListPriceHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ListPrice > 1000
7,442
works_cycles
What is the product with the most profit?
profit = SUBTRACT(ListPrice, StandardCost);
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
7,443
works_cycles
What is the name of the product stored in location 1 compartment L container 6?
compartment refers to Shelf;
SELECT T2.Name FROM ProductInventory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.LocationID = 1 AND T1.Shelf = 'L' AND T1.Bin = 6
7,444
works_cycles
What are locations of the work order "35493"?
SELECT T2.Name FROM WorkOrderRouting AS T1 INNER JOIN Location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.WorkOrderID = 35493
7,445
works_cycles
What are the products with a large photo?
product with large photo refers to LargePhoto NOT null;
SELECT T2.ProductID FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName LIKE '%large.gif'
7,446
works_cycles
List all the socks products.
Socks is a name of product subcategory
SELECT T2.ProductID FROM ProductSubcategory AS T1 INNER JOIN Product AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID WHERE T1.Name = 'Socks'
7,447
works_cycles
With 100$, how many Cable Lock can you buy?
number of products a $100 can buy = DIVIDE(100, ListPrice);
SELECT 100 / T2.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Cable Lock'
7,448
works_cycles
What is the scrap reason for work order "57788"?
SELECT T2.Name FROM WorkOrder AS T1 INNER JOIN ScrapReason AS T2 ON T1.ScrapReasonID = T2.ScrapReasonID WHERE T1.WorkOrderID = 57788
7,449
works_cycles
What is the cost for the sports?
cost refers to StandardCost;
SELECT T2.StandardCost FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE '%Sport%'
7,450
works_cycles
How many products with the id "476" are stored in Metal Storage?
Metal Storage is name of location
SELECT T2.Quantity FROM Location AS T1 INNER JOIN ProductInventory AS T2 ON T1.LocationID = T2.LocationID WHERE T2.ProductID = 476 AND T1.Name = 'Metal Storage'
7,451
works_cycles
List all the products with lower than average cost.
cost refers to StandardCost; lower than average cost = StandardCost<(AVG(StandardCost));
SELECT DISTINCT T2.ProductID FROM ProductCostHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.StandardCost < ( SELECT SUM(StandardCost) / COUNT(ProductID) FROM Product )
7,452
works_cycles
What is the the percentage of profit for the product "858"?
percentage of profit = DIVIDE(SUBTRACT(ListPrice, StandardCost), (StandardCost)) as percentage;
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
7,453
works_cycles
How many products with a thumpnail photo?
products with a thumbnail photo refers to ProductPhotoID ! = 1 ;
SELECT COUNT(ProductID) FROM ProductProductPhoto WHERE ProductPhotoID != 1
7,454
works_cycles
How many days did it take to end the work order "425"?
days to end a work order = SUBTRACT(ActualEndDate, ActualStartDate);
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
7,455
works_cycles
Which product has the highest price in 2012?
price refers to ListPrice; highest price refers to MAX(ListPrice);
SELECT ProductID FROM ProductListPriceHistory WHERE StartDate LIKE '2012%' ORDER BY ListPrice DESC LIMIT 1
7,456
works_cycles
What is the cost for the product "847"?
cost refers to StandardCost;
SELECT StandardCost FROM ProductCostHistory WHERE ProductID = 847
7,457
works_cycles
What is the organization level for Human Resources Manager?
Human Resources Manager is a job title
SELECT OrganizationLevel FROM Employee WHERE JobTitle = 'Human Resources Manager'
7,458
works_cycles
How many of the work orders didn’t meet the due date?
workers who did not meet the due date refers to EndDate>DueDate;
SELECT COUNT(WorkOrderID) FROM WorkOrder WHERE EndDate > DueDate
7,459
works_cycles
What is the cost and the product number of product with the id "888"?
cost refers to StandardCost;
SELECT T2.StandardCost, T2.ProductNumber FROM ProductCostHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 888
7,460
works_cycles
How many products using "roadster_black_small.gif" as the thumbnail photo?
products using roadster_black_small.gif as the thumbnail photo refers to ThumbnailPhotoFileName = 'roadster_black_small.gif';
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'
7,461
works_cycles
List the locations ids, compartments and containers for the Lock Ring
compartment refers to Shelf; container refers to Bin; Lock Ring is a name of product
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'
7,462
works_cycles
What category do Road Frames fall into?
Road Frames is a name of product subcategory
SELECT T2.Name FROM ProductSubcategory AS T1 INNER JOIN ProductCategory AS T2 ON T1.ProductCategoryID = T2.ProductCategoryID WHERE T1.Name = 'Road Frames'
7,463
works_cycles
List all the scraped work orders for handling damage reason.
handling damage is descrription of manufacturing failure which refers to ScrapReason.Name
SELECT T2.WorkOrderID FROM ScrapReason AS T1 INNER JOIN WorkOrder AS T2 ON T1.ScrapReasonID = T2.ScrapReasonID WHERE T1.Name = 'Handling damage'
7,464
works_cycles
What is the profit for the product "792"?
profit = SUBTRACT(ListPrice, StandardCost);
SELECT T1.ListPrice - T2.StandardCost FROM ProductListPriceHistory AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 792
7,465
works_cycles
Who owns the email address "[email protected]"?
SELECT T2.FirstName, T2.LastName FROM EmailAddress AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.EmailAddress = '[email protected]'
7,466
works_cycles
Where are the locations where the product "810" is stored?
SELECT T2.Name FROM ProductInventory AS T1 INNER JOIN Location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.ProductID = 810
7,467
works_cycles
What is the name of the product the work order "2540" was making?
SELECT T2.Name FROM WorkOrder AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.WorkOrderID = 2540
7,468
works_cycles
What is the price for the AWC Logo Cap?
price refers to ListPrice; price of 3 products = MULTIPLY(ListPrice, 3); Lock Washer 6 is a name of a product;
SELECT T2.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'AWC Logo Cap'
7,469
works_cycles
List all the work orders that is related to the Down Tube.
Down Tube is a name of a product;
SELECT T2.WorkOrderID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'
7,470
works_cycles
What is the the average percentage of profit for the all the product?
average profit percentage = DIVIDE(SUBTRACT(ListPrice, StandardCost)), (StandardCost)));
SELECT AVG((T1.ListPrice - T2.StandardCost) * 100 / T2.StandardCost) FROM ProductListPriceHistory AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID
7,471
works_cycles
What proportion of work order is in Subassembly?
proportion = DIVIDE(SUM(Name = 'Subassembly'). (COUNT(WorkOrderID)));
SELECT 100.0 * SUM(CASE WHEN T1.Name = 'Subassembly' THEN 1 ELSE 0 END) / COUNT(T2.WorkOrderID) FROM Location AS T1 INNER JOIN WorkOrderRouting AS T2 ON T1.LocationID = T2.LocationID
7,472
image_and_language
How many object samples are there in image no.1?
object samples refers to OBJ_SAMPLE_ID; image no.1 refers to IMG_ID = 1
SELECT COUNT(OBJ_SAMPLE_ID) FROM IMG_OBJ WHERE IMG_ID = 1
7,473
image_and_language
How many images have over 20 object samples?
over 20 object samples refers to COUNT(OBJ_SAMPLE_ID) > 20
SELECT COUNT(T1.IMG_ID) FROM ( SELECT IMG_ID FROM IMG_OBJ GROUP BY IMG_ID HAVING COUNT(OBJ_SAMPLE_ID) > 20 ) T1
7,474
image_and_language
What is the ID of the image with the most number of object samples?
ID of the image refers to IMG_ID; most number of object samples refers to max(count(OBJ_SAMPLE_ID))
SELECT IMG_ID FROM IMG_OBJ GROUP BY IMG_ID ORDER BY COUNT(OBJ_SAMPLE_ID) DESC LIMIT 1
7,475
image_and_language
Please list the IDs of the object samples in class no. 297 in image no.1.
IDs of the object samples refers to OBJ_SAMPLE_ID; class no. 297 in image no.1 refers to IMG_ID = 1 and OBJ_CLASS_ID = 297
SELECT OBJ_SAMPLE_ID FROM IMG_OBJ WHERE IMG_ID = 1 AND OBJ_CLASS_ID = 297
7,476
image_and_language
How many self-relations are there between the object samples in image no.5?
self-relations refers to OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID; image no.5 refers to IMG_ID = 5
SELECT SUM(CASE WHEN IMG_ID = 5 THEN 1 ELSE 0 END) FROM IMG_REL WHERE OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID
7,477
image_and_language
What is the bounding box of the object sample in image no.5 that has a self-relation?
bounding box of the object sample refers to (x, y, W, H); image no.5 refers to IMG_ID = 5; has a self-relation refers to OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID
SELECT T2.X, T2.Y, T2.W, T2.H FROM IMG_REL AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.IMG_ID = T2.IMG_ID WHERE T1.IMG_ID = 5 AND T1.OBJ1_SAMPLE_ID = T1.OBJ2_SAMPLE_ID
7,478
image_and_language
How many object samples in image no.1 are in the class of "man"?
object samples refers to OBJ_CLASS_ID; image no.1 refers to IMG_ID = 1; in the class of "man" refers to OBJ_CLASS = 'man'
SELECT SUM(CASE WHEN T1.OBJ_CLASS = 'man' THEN 1 ELSE 0 END) FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.IMG_ID = 1
7,479
image_and_language
How many images have at least one object sample in the class of "man"?
have at least one object sample in the class of "man" refers to count(IMG_ID where OBJ_CLASS = 'man') > = 1
SELECT COUNT(T.IMG_ID) FROM ( SELECT T2.IMG_ID FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T1.OBJ_CLASS = 'man' GROUP BY T2.IMG_ID ) T
7,480
image_and_language
Please list the classes of all the object samples in image no.1.
classes of all the object samples refers to OBJ_CLASS; image no.1 refers to IMG_ID = 1
SELECT T1.OBJ_CLASS FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.IMG_ID = 1 GROUP BY T1.OBJ_CLASS
7,481
image_and_language
What is the relation between object sample no.8 and object sample no.4 in image no.1?
relation refers to PRED_CLASS; object sample no.8 and object sample no.4 refers to OBJ1_SAMPLE_ID = 8 AND OBJ2_SAMPLE_ID = 4; image no.1 refers to IMG_ID = 1
SELECT T1.PRED_CLASS FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.IMG_ID = 1 AND T2.OBJ1_SAMPLE_ID = 8 AND T2.OBJ2_SAMPLE_ID = 4
7,482
image_and_language
How many pairs of object samples in image no.1 have the relation of "parked on"?
pairs of object samples refers to OBJ1_SAMPLE_ID and OBJ2_SAMPLE_ID; image no.1 refers to IMG_ID = 1; relation of "parked on" refers to PRED_CLASS = 'parked on'
SELECT SUM(CASE WHEN T1.PRED_CLASS = 'parked on' THEN 1 ELSE 0 END) FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.IMG_ID = 1 AND T2.OBJ1_SAMPLE_ID != OBJ2_SAMPLE_ID
7,483
image_and_language
Please list all the predicted relation classes of object sample no.14 in image no.1.
predicted relation classes refers to PRED_CLASS; object sample no.14 in image no.1 refers to OBJ1_SAMPLE_ID = 14 AND OBJ2_SAMPLE_ID = 14 and IMG_ID = 1
SELECT T1.PRED_CLASS FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.OBJ1_SAMPLE_ID = 14 AND T2.OBJ2_SAMPLE_ID = 14
7,484
image_and_language
How many images have at least one pair of object samples with the relation "parked on"?
How many images have at least one pair of object samples with the relation "parked on" refers to count(IMG_ID) where OBJ1_SAMPLE_ID ! = OBJ2_SAMPLE_ID and PRED_CLASS = 'parked on'
SELECT SUM(CASE WHEN T1.PRED_CLASS = 'parked on' THEN 1 ELSE 0 END) FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.OBJ1_SAMPLE_ID != T2.OBJ2_SAMPLE_ID
7,485
image_and_language
Please list the IDs of all the images with more than 2 pairs of object samples with the relation "parked on".
IDs of all the images refers to IMG_ID; relation "parked on" refers to PRED_CLASS = 'parked on'; more than 2 pairs refers to count(IMG_ID) where OBJ1_SAMPLE_ID ! = OBJ2_SAMPLE_ID
SELECT T2.IMG_ID FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T1.PRED_CLASS = 'parked on' AND T2.OBJ1_SAMPLE_ID != T2.OBJ2_SAMPLE_ID GROUP BY T2.IMG_ID HAVING COUNT(T2.IMG_ID) > 2
7,486
image_and_language
To which predicted relation class does the self-relation of the object sample in image no.5 belong?
predicted relation class refers to PRED_CLASS; self-relations refers to OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID; image no.5 refers to IMG_ID = 5
SELECT T1.PRED_CLASS FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.IMG_ID = 5 AND T2.OBJ1_SAMPLE_ID = T2.OBJ2_SAMPLE_ID
7,487
image_and_language
What are the bounding boxes of the object samples with a predicted relation class of "by" in image no.1?
bounding boxes of the object samples refers to (x, y, W, H); predicted relation class of "by" refers to PRED_CLASS = 'by'; image no.1 refers to IMG_ID = 1
SELECT T3.X, T3.Y, T3.W, T3.H FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.OBJ1_SAMPLE_ID = T3.OBJ_CLASS_ID WHERE T2.IMG_ID = 1 AND T1.PRED_CLASS = 'by'
7,488
image_and_language
What is the average difference in the y coordinate of 2 object samples with the relation "parked on" in image no.1?
relation "parked on" refers to PRED_CLASS = 'parked on'; image no.1 refers to IMG_ID = 1; average difference in the y coordinate = divide(sum(Y), count(PRED_CLASS)) where OBJ1_SAMPLE_ID ! = OBJ2_SAMPLE_ID
SELECT CAST(SUM(T3.Y) AS REAL) / COUNT(CASE WHEN T1.PRED_CLASS = 'parked on' THEN 1 ELSE NULL END) FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T2.OBJ1_SAMPLE_ID = T3.OBJ_CLASS_ID WHERE T2.IMG_ID = 1 AND T2.OBJ1_SAMPLE_ID != T2.OBJ2_SAMPLE_ID
7,489
image_and_language
What is the percentage of the object samples in the class of "man" in image no.1?
object samples refers to OBJ_SAMPLE_ID; class of "man" refers to OBJ_CLASS = 'man'; image no.1 refers to IMG_ID = 1; percentage = divide(count(OBJ_SAMPLE_ID)when OBJ_CLASS = 'man', count(OBJ_SAMPLE_ID)) as percentage
SELECT CAST(COUNT(CASE WHEN T1.OBJ_CLASS = 'man' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.OBJ_CLASS_ID) FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.IMG_ID = 1
7,490
image_and_language
State the total number of the attribute classes.
attribute classes refers to ATT_CLASS
SELECT COUNT(ATT_CLASS_ID) FROM ATT_CLASSES
7,491
image_and_language
How many object classes are there in the database?
object classes refers to OBJ_CLASS
SELECT COUNT(OBJ_CLASS_ID) FROM OBJ_CLASSES
7,492
image_and_language
Provide the number of predicted classes.
predicted classes refers to PRED_CLASS
SELECT COUNT(PRED_CLASS_ID) FROM PRED_CLASSES
7,493
image_and_language
Give the bounding box of the kite in image no.2324765.
bounding box refers to (x, y, W, H); kite refers to OBJ_CLASS = 'kite'; image no.2324765 refers to IMG_ID = 2324765
SELECT T2.X, T2.Y, T2.W, T2.H FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.IMG_ID = 2324765 AND T1.OBJ_CLASS = 'kite'
7,494
image_and_language
How many white objects are there in image no.2347915?
white objects refers to ATT_CLASS = 'white'; image no.2347915 refers to IMG_ID = 2347915
SELECT SUM(CASE WHEN T2.ATT_CLASS = 'white' THEN 1 ELSE 0 END) FROM IMG_OBJ_ATT AS T1 INNER JOIN ATT_CLASSES AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T1.IMG_ID = 2347915
7,495
image_and_language
Give the number of samples in image no.2377985 whose attribute is electrical.
number of samples refers to OBJ_SAMPLE_ID; image no.2377985 refers to IMG_ID = 2377985; attribute is electrical refers to ATT_CLASS = 'electrical'
SELECT SUM(CASE WHEN T2.ATT_CLASS = 'white' THEN 1 ELSE 0 END) FROM IMG_OBJ_ATT AS T1 INNER JOIN ATT_CLASSES AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID WHERE T1.IMG_ID = 2347915
7,496
image_and_language
What is the relationship between object sample no.12 and no.8 of image no.2345511?
relationship refers to PRED_CLASS; object sample no.12 and no.8 of image no.2345511 refers to IMG_ID = 2345511 AND OBJ1_SAMPLE_ID = 12 AND OBJ2_SAMPLE_ID = 8
SELECT T1.PRED_CLASS FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.IMG_ID = 2345511 AND T2.OBJ1_SAMPLE_ID = 12 AND T2.OBJ2_SAMPLE_ID = 8
7,497
image_and_language
Give the object number of the sample which has the relationship of "lying on" with object sample no.1 from image no.2345524.
object number of the sample refers to OBJ1_SAMPLE_ID; object sample no.1 from image no.2345524 refers to OBJ2_SAMPLE_ID = 1 and IMG_ID = 2345524
SELECT T2.OBJ1_SAMPLE_ID FROM PRED_CLASSES AS T1 INNER JOIN IMG_REL AS T2 ON T1.PRED_CLASS_ID = T2.PRED_CLASS_ID WHERE T2.IMG_ID = 2345524 AND T1.PRED_CLASS = 'lying on' AND T2.OBJ2_SAMPLE_ID = 1
7,498
image_and_language
How many samples of food object are there in image no.6?
samples of food object refers to OBJ_CLASS = 'food'; image no.6 refers to IMG_ID = 6
SELECT COUNT(T2.OBJ_SAMPLE_ID) FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID WHERE T2.IMG_ID = 6 AND T1.OBJ_CLASS = 'food'
7,499