input
stringlengths 193
2.69k
| output
stringlengths 24
744
|
|---|---|
[INST] Here is a database schema:
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the phone numbers of all the store contacts. [/INST]
|
SELECT T2.PhoneNumber FROM Person AS T1 INNER JOIN PersonPhone AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SC';
|
[INST] Here is a database schema:
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the hashed password of David Bradley? [/INST]
|
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';
|
[INST] Here is a database schema:
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the e-mail addresses of all the employees who wish to receive e-mail promotions from Adventureworks and selected partners. [/INST]
|
SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.EmailPromotion = 2;
|
[INST] Here is a database schema:
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please show the credit card number of David Bradley. [/INST]
|
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';
|
[INST] Here is a database schema:
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: In which year will the David Bradley's credit card expire? [/INST]
|
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';
|
[INST] Here is a database schema:
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the names of all the store contact employees whose credit cards expired in 2007. [/INST]
|
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';
|
[INST] Here is a database schema:
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the store contact employees, how many of them have a Vista credit card? [/INST]
|
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';
|
[INST] Here is a database schema:
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many departments have David Bradley been in? [/INST]
|
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';
|
[INST] Here is a database schema:
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the departments that David Bradley used to belong to. [/INST]
|
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';
|
[INST] Here is a database schema:
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many people were there in the Engineering Department in the year 2009? [/INST]
|
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';
|
[INST] Here is a database schema:
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which employee has been in the Engineering Department the longest? Please give his or her firstname and lastname. [/INST]
|
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;
|
[INST] Here is a database schema:
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the employees in the Manufacturing group in 2007, how many of them are store contacts? [/INST]
|
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';
|
[INST] Here is a database schema:
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the credit card numbers of all the employees who have left the Finance Department. [/INST]
|
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;
|
[INST] Here is a database schema:
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many employees working in the Engineering Department in 2007 would have their credit cards expired in the same year? [/INST]
|
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';
|
[INST] Here is a database schema:
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the e-mail address of the employee who switched departments for the most times? [/INST]
|
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;
|
[INST] Here is a database schema:
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Among all the employees who don't wish to receive promotion e-mails, how many of them belong to or once belonged to the Engineering Department? [/INST]
|
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;
|
[INST] Here is a database schema:
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many employees came into the Quality Assurance Group in the year 2007? [/INST]
|
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';
|
[INST] Here is a database schema:
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the product names of all the products on the LL Road Frame Sale. [/INST]
|
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';
|
[INST] Here is a database schema:
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many products were on the LL Road Frame Sale? [/INST]
|
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';
|
[INST] Here is a database schema:
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Has the product Chainring Bolts been on any of the sales? [/INST]
|
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';
|
[INST] Here is a database schema:
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many products from the Clothing category were on the LL Road Frame Sale? [/INST]
|
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';
|
[INST] Here is a database schema:
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the products that are under the Clothing category that are manufactured in-house and salable. [/INST]
|
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;
|
[INST] Here is a database schema:
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: For all the employees that have left the Engineering Department, what is the average time of their stay? [/INST]
|
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;
|
[INST] Here is a database schema:
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the average pay rate of the employees who worked in the Engineering Departmentin 2007? [/INST]
|
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';
|
[INST] Here is a database schema:
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How much more expensive in percentage is the product with the highest selling price from the product with the lowest selling price in the Clothing category? [/INST]
|
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';
|
[INST] Here is a database schema:
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the average profit of all the products from the Clothing category? [/INST]
|
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';
|
[INST] Here is a database schema:
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which product cost the least in 2013? [/INST]
|
SELECT ProductID FROM ProductCostHistory WHERE StartDate LIKE '2013%' ORDER BY StandardCost LIMIT 1;
|
[INST] Here is a database schema:
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List all products with the color yellow. [/INST]
|
SELECT ProductID FROM Product WHERE Color = 'Yellow';
|
[INST] Here is a database schema:
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the bussiness id for Mr. Hung-Fu Ting? [/INST]
|
SELECT BusinessEntityID FROM Person WHERE Title = 'Mr.' AND FirstName = 'Hung-Fu' AND LastName = 'Ting';
|
[INST] Here is a database schema:
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the price for the product with the id "912"? [/INST]
|
SELECT ListPrice FROM ProductListPriceHistory WHERE ProductID = 912;
|
[INST] Here is a database schema:
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Is there a work order where the planned cost is different from the actual cost? [/INST]
|
SELECT CASE WHEN ActualCost = PlannedCost THEN 'No' ELSE 'Yes' END FROM WorkOrderRouting;
|
[INST] Here is a database schema:
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the thumbnail photo file for the product with the id "979"? [/INST]
|
SELECT T2.ThumbnailPhotoFileName FROM ProductProductPhoto AS T1 INNER JOIN ProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.ProductID = 979;
|
[INST] Here is a database schema:
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List all the names of the products with the price of more than 1000$. [/INST]
|
SELECT DISTINCT T2.Name FROM ProductListPriceHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ListPrice > 1000;
|
[INST] Here is a database schema:
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the product with the most profit? [/INST]
|
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;
|
[INST] Here is a database schema:
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the name of the product stored in location 1 compartment L container 6? [/INST]
|
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;
|
[INST] Here is a database schema:
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What are locations of the work order "35493"? [/INST]
|
SELECT T2.Name FROM WorkOrderRouting AS T1 INNER JOIN Location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.WorkOrderID = 35493;
|
[INST] Here is a database schema:
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What are the products with a large photo? [/INST]
|
SELECT T2.ProductID FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T1.LargePhotoFileName LIKE '%large.gif';
|
[INST] Here is a database schema:
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List all the socks products. [/INST]
|
SELECT T2.ProductID FROM ProductSubcategory AS T1 INNER JOIN Product AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID WHERE T1.Name = 'Socks';
|
[INST] Here is a database schema:
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: With 100$, how many Cable Lock can you buy? [/INST]
|
SELECT 100 / T2.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Cable Lock';
|
[INST] Here is a database schema:
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the scrap reason for work order "57788"? [/INST]
|
SELECT T2.Name FROM WorkOrder AS T1 INNER JOIN ScrapReason AS T2 ON T1.ScrapReasonID = T2.ScrapReasonID WHERE T1.WorkOrderID = 57788;
|
[INST] Here is a database schema:
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the cost for the sports? [/INST]
|
SELECT T2.StandardCost FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE '%Sport%';
|
[INST] Here is a database schema:
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many products with the id "476" are stored in Metal Storage? [/INST]
|
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';
|
[INST] Here is a database schema:
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List all the products with lower than average cost. [/INST]
|
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 );
|
[INST] Here is a database schema:
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the the percentage of profit for the product "858"? [/INST]
|
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;
|
[INST] Here is a database schema:
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many products with a thumpnail photo? [/INST]
|
SELECT COUNT(ProductID) FROM ProductProductPhoto WHERE ProductPhotoID != 1;
|
[INST] Here is a database schema:
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many days did it take to end the work order "425"? [/INST]
|
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;
|
[INST] Here is a database schema:
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which product has the highest price in 2012? [/INST]
|
SELECT ProductID FROM ProductListPriceHistory WHERE StartDate LIKE '2012%' ORDER BY ListPrice DESC LIMIT 1;
|
[INST] Here is a database schema:
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the cost for the product "847"? [/INST]
|
SELECT StandardCost FROM ProductCostHistory WHERE ProductID = 847;
|
[INST] Here is a database schema:
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the organization level for Human Resources Manager? [/INST]
|
SELECT OrganizationLevel FROM Employee WHERE JobTitle = 'Human Resources Manager';
|
[INST] Here is a database schema:
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many of the work orders didn’t meet the due date? [/INST]
|
SELECT COUNT(WorkOrderID) FROM WorkOrder WHERE EndDate > DueDate;
|
[INST] Here is a database schema:
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the cost and the product number of product with the id "888"? [/INST]
|
SELECT T2.StandardCost, T2.ProductNumber FROM ProductCostHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 888;
|
[INST] Here is a database schema:
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many products using "roadster_black_small.gif" as the thumbnail photo? [/INST]
|
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';
|
[INST] Here is a database schema:
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List the locations ids, compartments and containers for the Lock Ring [/INST]
|
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';
|
[INST] Here is a database schema:
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What category do Road Frames fall into? [/INST]
|
SELECT T2.Name FROM ProductSubcategory AS T1 INNER JOIN ProductCategory AS T2 ON T1.ProductCategoryID = T2.ProductCategoryID WHERE T1.Name = 'Road Frames';
|
[INST] Here is a database schema:
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List all the scraped work orders for handling damage reason. [/INST]
|
SELECT T2.WorkOrderID FROM ScrapReason AS T1 INNER JOIN WorkOrder AS T2 ON T1.ScrapReasonID = T2.ScrapReasonID WHERE T1.Name = 'Handling damage';
|
[INST] Here is a database schema:
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the profit for the product "792"? [/INST]
|
SELECT T1.ListPrice - T2.StandardCost FROM ProductListPriceHistory AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 792;
|
[INST] Here is a database schema:
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Who owns the email address "regina7@adventure-works.com"? [/INST]
|
SELECT T2.FirstName, T2.LastName FROM EmailAddress AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.EmailAddress = 'regina7@adventure-works.com';
|
[INST] Here is a database schema:
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Where are the locations where the product "810" is stored? [/INST]
|
SELECT T2.Name FROM ProductInventory AS T1 INNER JOIN Location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.ProductID = 810;
|
[INST] Here is a database schema:
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the name of the product the work order "2540" was making? [/INST]
|
SELECT T2.Name FROM WorkOrder AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.WorkOrderID = 2540;
|
[INST] Here is a database schema:
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the price for the AWC Logo Cap? [/INST]
|
SELECT T2.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'AWC Logo Cap';
|
[INST] Here is a database schema:
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List all the work orders that is related to the Down Tube. [/INST]
|
SELECT T2.WorkOrderID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube';
|
[INST] Here is a database schema:
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the the average percentage of profit for the all the product? [/INST]
|
SELECT AVG((T1.ListPrice - T2.StandardCost) * 100 / T2.StandardCost) FROM ProductListPriceHistory AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID;
|
[INST] Here is a database schema:
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What proportion of work order is in Subassembly? [/INST]
|
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;
|
[INST] Here is a database schema:
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
Please write me a SQL statement that answers the following question: How many object samples are there in image no.1? [/INST]
|
SELECT COUNT(OBJ_SAMPLE_ID) FROM IMG_OBJ WHERE IMG_ID = 1;
|
[INST] Here is a database schema:
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
Please write me a SQL statement that answers the following question: How many images have over 20 object samples? [/INST]
|
SELECT COUNT(T1.IMG_ID) FROM ( SELECT IMG_ID FROM IMG_OBJ GROUP BY IMG_ID HAVING COUNT(OBJ_SAMPLE_ID) > 20 ) T1;
|
[INST] Here is a database schema:
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
Please write me a SQL statement that answers the following question: What is the ID of the image with the most number of object samples? [/INST]
|
SELECT IMG_ID FROM IMG_OBJ GROUP BY IMG_ID ORDER BY COUNT(OBJ_SAMPLE_ID) DESC LIMIT 1;
|
[INST] Here is a database schema:
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
Please write me a SQL statement that answers the following question: Please list the IDs of the object samples in class no. 297 in image no.1. [/INST]
|
SELECT OBJ_SAMPLE_ID FROM IMG_OBJ WHERE IMG_ID = 1 AND OBJ_CLASS_ID = 297;
|
[INST] Here is a database schema:
IMG_REL :
IMG_ID [ INTEGER ] IMG_REL.IMG_ID = IMG_OBJ.IMG_ID
PRED_CLASS_ID [ INTEGER ] IMG_REL.PRED_CLASS_ID = PRED_CLASSES.PRED_CLASS_ID
OBJ1_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ1_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
OBJ2_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ2_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: How many self-relations are there between the object samples in image no.5? [/INST]
|
SELECT SUM(CASE WHEN IMG_ID = 5 THEN 1 ELSE 0 END) FROM IMG_REL WHERE OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID;
|
[INST] Here is a database schema:
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
IMG_REL :
IMG_ID [ INTEGER ] IMG_REL.IMG_ID = IMG_OBJ.IMG_ID
PRED_CLASS_ID [ INTEGER ] IMG_REL.PRED_CLASS_ID = PRED_CLASSES.PRED_CLASS_ID
OBJ1_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ1_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
OBJ2_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ2_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: What is the bounding box of the object sample in image no.5 that has a self-relation? [/INST]
|
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;
|
[INST] Here is a database schema:
OBJ_CLASSES :
OBJ_CLASS_ID [ INTEGER ] primary_key
OBJ_CLASS [ TEXT ]
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
Please write me a SQL statement that answers the following question: How many object samples in image no.1 are in the class of "man"? [/INST]
|
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;
|
[INST] Here is a database schema:
OBJ_CLASSES :
OBJ_CLASS_ID [ INTEGER ] primary_key
OBJ_CLASS [ TEXT ]
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
Please write me a SQL statement that answers the following question: How many images have at least one object sample in the class of "man"? [/INST]
|
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;
|
[INST] Here is a database schema:
OBJ_CLASSES :
OBJ_CLASS_ID [ INTEGER ] primary_key
OBJ_CLASS [ TEXT ]
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
Please write me a SQL statement that answers the following question: Please list the classes of all the object samples in image no.1. [/INST]
|
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;
|
[INST] Here is a database schema:
PRED_CLASSES :
PRED_CLASS_ID [ INTEGER ] primary_key
PRED_CLASS [ TEXT ]
IMG_REL :
IMG_ID [ INTEGER ] IMG_REL.IMG_ID = IMG_OBJ.IMG_ID
PRED_CLASS_ID [ INTEGER ] IMG_REL.PRED_CLASS_ID = PRED_CLASSES.PRED_CLASS_ID
OBJ1_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ1_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
OBJ2_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ2_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: What is the relation between object sample no.8 and object sample no.4 in image no.1? [/INST]
|
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;
|
[INST] Here is a database schema:
PRED_CLASSES :
PRED_CLASS_ID [ INTEGER ] primary_key
PRED_CLASS [ TEXT ]
IMG_REL :
IMG_ID [ INTEGER ] IMG_REL.IMG_ID = IMG_OBJ.IMG_ID
PRED_CLASS_ID [ INTEGER ] IMG_REL.PRED_CLASS_ID = PRED_CLASSES.PRED_CLASS_ID
OBJ1_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ1_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
OBJ2_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ2_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: How many pairs of object samples in image no.1 have the relation of "parked on"? [/INST]
|
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;
|
[INST] Here is a database schema:
PRED_CLASSES :
PRED_CLASS_ID [ INTEGER ] primary_key
PRED_CLASS [ TEXT ]
IMG_REL :
IMG_ID [ INTEGER ] IMG_REL.IMG_ID = IMG_OBJ.IMG_ID
PRED_CLASS_ID [ INTEGER ] IMG_REL.PRED_CLASS_ID = PRED_CLASSES.PRED_CLASS_ID
OBJ1_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ1_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
OBJ2_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ2_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: Please list all the predicted relation classes of object sample no.14 in image no.1. [/INST]
|
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;
|
[INST] Here is a database schema:
PRED_CLASSES :
PRED_CLASS_ID [ INTEGER ] primary_key
PRED_CLASS [ TEXT ]
IMG_REL :
IMG_ID [ INTEGER ] IMG_REL.IMG_ID = IMG_OBJ.IMG_ID
PRED_CLASS_ID [ INTEGER ] IMG_REL.PRED_CLASS_ID = PRED_CLASSES.PRED_CLASS_ID
OBJ1_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ1_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
OBJ2_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ2_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: How many images have at least one pair of object samples with the relation "parked on"? [/INST]
|
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;
|
[INST] Here is a database schema:
PRED_CLASSES :
PRED_CLASS_ID [ INTEGER ] primary_key
PRED_CLASS [ TEXT ]
IMG_REL :
IMG_ID [ INTEGER ] IMG_REL.IMG_ID = IMG_OBJ.IMG_ID
PRED_CLASS_ID [ INTEGER ] IMG_REL.PRED_CLASS_ID = PRED_CLASSES.PRED_CLASS_ID
OBJ1_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ1_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
OBJ2_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ2_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: Please list the IDs of all the images with more than 2 pairs of object samples with the relation "parked on". [/INST]
|
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;
|
[INST] Here is a database schema:
PRED_CLASSES :
PRED_CLASS_ID [ INTEGER ] primary_key
PRED_CLASS [ TEXT ]
IMG_REL :
IMG_ID [ INTEGER ] IMG_REL.IMG_ID = IMG_OBJ.IMG_ID
PRED_CLASS_ID [ INTEGER ] IMG_REL.PRED_CLASS_ID = PRED_CLASSES.PRED_CLASS_ID
OBJ1_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ1_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
OBJ2_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ2_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: To which predicted relation class does the self-relation of the object sample in image no.5 belong? [/INST]
|
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;
|
[INST] Here is a database schema:
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
PRED_CLASSES :
PRED_CLASS_ID [ INTEGER ] primary_key
PRED_CLASS [ TEXT ]
IMG_REL :
IMG_ID [ INTEGER ] IMG_REL.IMG_ID = IMG_OBJ.IMG_ID
PRED_CLASS_ID [ INTEGER ] IMG_REL.PRED_CLASS_ID = PRED_CLASSES.PRED_CLASS_ID
OBJ1_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ1_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
OBJ2_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ2_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: What are the bounding boxes of the object samples with a predicted relation class of "by" in image no.1? [/INST]
|
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';
|
[INST] Here is a database schema:
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
PRED_CLASSES :
PRED_CLASS_ID [ INTEGER ] primary_key
PRED_CLASS [ TEXT ]
IMG_REL :
IMG_ID [ INTEGER ] IMG_REL.IMG_ID = IMG_OBJ.IMG_ID
PRED_CLASS_ID [ INTEGER ] IMG_REL.PRED_CLASS_ID = PRED_CLASSES.PRED_CLASS_ID
OBJ1_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ1_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
OBJ2_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ2_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: What is the average difference in the y coordinate of 2 object samples with the relation "parked on" in image no.1? [/INST]
|
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;
|
[INST] Here is a database schema:
OBJ_CLASSES :
OBJ_CLASS_ID [ INTEGER ] primary_key
OBJ_CLASS [ TEXT ]
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
Please write me a SQL statement that answers the following question: What is the percentage of the object samples in the class of "man" in image no.1? [/INST]
|
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;
|
[INST] Here is a database schema:
ATT_CLASSES :
ATT_CLASS_ID [ INTEGER ] primary_key
ATT_CLASS [ TEXT ]
Please write me a SQL statement that answers the following question: State the total number of the attribute classes. [/INST]
|
SELECT COUNT(ATT_CLASS_ID) FROM ATT_CLASSES;
|
[INST] Here is a database schema:
OBJ_CLASSES :
OBJ_CLASS_ID [ INTEGER ] primary_key
OBJ_CLASS [ TEXT ]
Please write me a SQL statement that answers the following question: How many object classes are there in the database? [/INST]
|
SELECT COUNT(OBJ_CLASS_ID) FROM OBJ_CLASSES;
|
[INST] Here is a database schema:
PRED_CLASSES :
PRED_CLASS_ID [ INTEGER ] primary_key
PRED_CLASS [ TEXT ]
Please write me a SQL statement that answers the following question: Provide the number of predicted classes. [/INST]
|
SELECT COUNT(PRED_CLASS_ID) FROM PRED_CLASSES;
|
[INST] Here is a database schema:
OBJ_CLASSES :
OBJ_CLASS_ID [ INTEGER ] primary_key
OBJ_CLASS [ TEXT ]
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
Please write me a SQL statement that answers the following question: Give the bounding box of the kite in image no.2324765. [/INST]
|
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';
|
[INST] Here is a database schema:
ATT_CLASSES :
ATT_CLASS_ID [ INTEGER ] primary_key
ATT_CLASS [ TEXT ]
IMG_OBJ_ATT :
IMG_ID [ INTEGER ] IMG_OBJ_ATT.IMG_ID = IMG_OBJ.IMG_ID
ATT_CLASS_ID [ INTEGER ] IMG_OBJ_ATT.ATT_CLASS_ID = ATT_CLASSES.ATT_CLASS_ID
OBJ_SAMPLE_ID [ INTEGER ] IMG_OBJ_ATT.OBJ_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: How many white objects are there in image no.2347915? [/INST]
|
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;
|
[INST] Here is a database schema:
ATT_CLASSES :
ATT_CLASS_ID [ INTEGER ] primary_key
ATT_CLASS [ TEXT ]
IMG_OBJ_ATT :
IMG_ID [ INTEGER ] IMG_OBJ_ATT.IMG_ID = IMG_OBJ.IMG_ID
ATT_CLASS_ID [ INTEGER ] IMG_OBJ_ATT.ATT_CLASS_ID = ATT_CLASSES.ATT_CLASS_ID
OBJ_SAMPLE_ID [ INTEGER ] IMG_OBJ_ATT.OBJ_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: Give the number of samples in image no.2377985 whose attribute is electrical. [/INST]
|
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;
|
[INST] Here is a database schema:
PRED_CLASSES :
PRED_CLASS_ID [ INTEGER ] primary_key
PRED_CLASS [ TEXT ]
IMG_REL :
IMG_ID [ INTEGER ] IMG_REL.IMG_ID = IMG_OBJ.IMG_ID
PRED_CLASS_ID [ INTEGER ] IMG_REL.PRED_CLASS_ID = PRED_CLASSES.PRED_CLASS_ID
OBJ1_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ1_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
OBJ2_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ2_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: What is the relationship between object sample no.12 and no.8 of image no.2345511? [/INST]
|
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;
|
[INST] Here is a database schema:
PRED_CLASSES :
PRED_CLASS_ID [ INTEGER ] primary_key
PRED_CLASS [ TEXT ]
IMG_REL :
IMG_ID [ INTEGER ] IMG_REL.IMG_ID = IMG_OBJ.IMG_ID
PRED_CLASS_ID [ INTEGER ] IMG_REL.PRED_CLASS_ID = PRED_CLASSES.PRED_CLASS_ID
OBJ1_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ1_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
OBJ2_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ2_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: Give the object number of the sample which has the relationship of "lying on" with object sample no.1 from image no.2345524. [/INST]
|
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;
|
[INST] Here is a database schema:
OBJ_CLASSES :
OBJ_CLASS_ID [ INTEGER ] primary_key
OBJ_CLASS [ TEXT ]
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
Please write me a SQL statement that answers the following question: How many samples of food object are there in image no.6? [/INST]
|
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';
|
[INST] Here is a database schema:
OBJ_CLASSES :
OBJ_CLASS_ID [ INTEGER ] primary_key
OBJ_CLASS [ TEXT ]
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
Please write me a SQL statement that answers the following question: Give the number of images containing the object sample of "suit". [/INST]
|
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 = 'suit' GROUP BY T2.IMG_ID ) T;
|
[INST] Here is a database schema:
OBJ_CLASSES :
OBJ_CLASS_ID [ INTEGER ] primary_key
OBJ_CLASS [ TEXT ]
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
PRED_CLASSES :
PRED_CLASS_ID [ INTEGER ] primary_key
PRED_CLASS [ TEXT ]
IMG_REL :
IMG_ID [ INTEGER ] IMG_REL.IMG_ID = IMG_OBJ.IMG_ID
PRED_CLASS_ID [ INTEGER ] IMG_REL.PRED_CLASS_ID = PRED_CLASSES.PRED_CLASS_ID
OBJ1_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ1_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
OBJ2_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ2_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: What is the relationship between "feathers" and "onion" in image no.2345528? [/INST]
|
SELECT T1.PRED_CLASS 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_SAMPLE_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE (T4.OBJ_CLASS = 'feathers' OR T4.OBJ_CLASS = 'onion') AND T2.IMG_ID = 2345528 GROUP BY T1.PRED_CLASS;
|
[INST] Here is a database schema:
ATT_CLASSES :
ATT_CLASS_ID [ INTEGER ] primary_key
ATT_CLASS [ TEXT ]
OBJ_CLASSES :
OBJ_CLASS_ID [ INTEGER ] primary_key
OBJ_CLASS [ TEXT ]
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
IMG_OBJ_ATT :
IMG_ID [ INTEGER ] IMG_OBJ_ATT.IMG_ID = IMG_OBJ.IMG_ID
ATT_CLASS_ID [ INTEGER ] IMG_OBJ_ATT.ATT_CLASS_ID = ATT_CLASSES.ATT_CLASS_ID
OBJ_SAMPLE_ID [ INTEGER ] IMG_OBJ_ATT.OBJ_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: Tell the attribute of the weeds in image no.2377988. [/INST]
|
SELECT T2.ATT_CLASS FROM IMG_OBJ_att AS T1 INNER JOIN ATT_CLASSES AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T1.IMG_ID = T3.IMG_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE T4.OBJ_CLASS = 'weeds' AND T1.IMG_ID = 2377988;
|
[INST] Here is a database schema:
ATT_CLASSES :
ATT_CLASS_ID [ INTEGER ] primary_key
ATT_CLASS [ TEXT ]
OBJ_CLASSES :
OBJ_CLASS_ID [ INTEGER ] primary_key
OBJ_CLASS [ TEXT ]
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
IMG_OBJ_ATT :
IMG_ID [ INTEGER ] IMG_OBJ_ATT.IMG_ID = IMG_OBJ.IMG_ID
ATT_CLASS_ID [ INTEGER ] IMG_OBJ_ATT.ATT_CLASS_ID = ATT_CLASSES.ATT_CLASS_ID
OBJ_SAMPLE_ID [ INTEGER ] IMG_OBJ_ATT.OBJ_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: What is the object whose attribute is blurry in image no.2377993? Give the explanation about the object. [/INST]
|
SELECT T4.OBJ_CLASS_ID, T4.OBJ_CLASS FROM IMG_OBJ_att AS T1 INNER JOIN ATT_CLASSES AS T2 ON T1.ATT_CLASS_ID = T2.ATT_CLASS_ID INNER JOIN IMG_OBJ AS T3 ON T1.IMG_ID = T3.IMG_ID INNER JOIN OBJ_CLASSES AS T4 ON T3.OBJ_CLASS_ID = T4.OBJ_CLASS_ID WHERE T2.ATT_CLASS = 'blurry' AND T1.IMG_ID = 22377993;
|
[INST] Here is a database schema:
OBJ_CLASSES :
OBJ_CLASS_ID [ INTEGER ] primary_key
OBJ_CLASS [ TEXT ]
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
Please write me a SQL statement that answers the following question: How many samples of "wall" are there in image no.2353079? [/INST]
|
SELECT SUM(CASE WHEN T1.OBJ_CLASS = 'wall' 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 = 2353079;
|
[INST] Here is a database schema:
OBJ_CLASSES :
OBJ_CLASS_ID [ INTEGER ] primary_key
OBJ_CLASS [ TEXT ]
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
Please write me a SQL statement that answers the following question: State the object class of sample no.10 of image no.2320341. [/INST]
|
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 = 2320341 AND T2.OBJ_SAMPLE_ID = 10;
|
[INST] Here is a database schema:
OBJ_CLASSES :
OBJ_CLASS_ID [ INTEGER ] primary_key
OBJ_CLASS [ TEXT ]
IMG_OBJ :
IMG_ID [ INTEGER ]
OBJ_SAMPLE_ID [ INTEGER ]
OBJ_CLASS_ID [ INTEGER ] IMG_OBJ.OBJ_CLASS_ID = OBJ_CLASSES.OBJ_CLASS_ID
X [ INTEGER ]
Y [ INTEGER ]
W [ INTEGER ]
H [ INTEGER ]
Please write me a SQL statement that answers the following question: How many times is the number of images containing "broccoli" than "tomato"? [/INST]
|
SELECT CAST(COUNT(CASE WHEN T1.OBJ_CLASS = 'broccoli' THEN T2.OBJ_SAMPLE_ID ELSE NULL END) AS REAL) / COUNT(CASE WHEN T1.OBJ_CLASS = 'tomato' THEN T2.OBJ_SAMPLE_ID ELSE NULL END) times FROM OBJ_CLASSES AS T1 INNER JOIN IMG_OBJ AS T2 ON T1.OBJ_CLASS_ID = T2.OBJ_CLASS_ID;
|
[INST] Here is a database schema:
IMG_OBJ_ATT :
IMG_ID [ INTEGER ] IMG_OBJ_ATT.IMG_ID = IMG_OBJ.IMG_ID
ATT_CLASS_ID [ INTEGER ] IMG_OBJ_ATT.ATT_CLASS_ID = ATT_CLASSES.ATT_CLASS_ID
OBJ_SAMPLE_ID [ INTEGER ] IMG_OBJ_ATT.OBJ_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: How many images have at least 25 attributes? [/INST]
|
SELECT COUNT(*) FROM ( SELECT IMG_ID FROM IMG_OBJ_att GROUP BY IMG_ID HAVING COUNT(ATT_CLASS_ID) > 25 ) T1;
|
[INST] Here is a database schema:
IMG_REL :
IMG_ID [ INTEGER ] IMG_REL.IMG_ID = IMG_OBJ.IMG_ID
PRED_CLASS_ID [ INTEGER ] IMG_REL.PRED_CLASS_ID = PRED_CLASSES.PRED_CLASS_ID
OBJ1_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ1_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
OBJ2_SAMPLE_ID [ INTEGER ] IMG_REL.OBJ2_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: List all the ids of the images that have a self-relation relationship. [/INST]
|
SELECT DISTINCT IMG_ID FROM IMG_REL WHERE OBJ1_SAMPLE_ID = OBJ2_SAMPLE_ID;
|
[INST] Here is a database schema:
IMG_OBJ_ATT :
IMG_ID [ INTEGER ] IMG_OBJ_ATT.IMG_ID = IMG_OBJ.IMG_ID
ATT_CLASS_ID [ INTEGER ] IMG_OBJ_ATT.ATT_CLASS_ID = ATT_CLASSES.ATT_CLASS_ID
OBJ_SAMPLE_ID [ INTEGER ] IMG_OBJ_ATT.OBJ_SAMPLE_ID = IMG_OBJ.OBJ_SAMPLE_ID
Please write me a SQL statement that answers the following question: How many objects are there in the attribute class id with the highest number of objects? [/INST]
|
SELECT COUNT(ATT_CLASS_ID) FROM IMG_OBJ_att GROUP BY IMG_ID ORDER BY COUNT(ATT_CLASS_ID) DESC LIMIT 1;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.