input stringlengths 122 2.7k | output stringlengths 24 805 |
|---|---|
[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 ]
Pr... | SELECT T1.Name FROM ProductSubcategory AS T1 INNER JOIN Product AS T2 USING (ProductSubcategoryID) WHERE T2.Color = 'Grey' GROUP BY T1.Name; |
[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 ]
Finished... | SELECT T2.EndDate FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.WeightUnitMeasureCode = 'G' ORDER BY T1.Weight DESC LIMIT 1; |
[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 ]
HireDat... | SELECT CAST(SUM(CASE WHEN T2.VacationHours > 20 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.SickLeaveHours > 10; |
[INST] Here is a database schema:
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrde... | SELECT CAST(SUM(IIF(T1.ShipMethodID = 5, T3.OrderQty, 0)) AS REAL) / COUNT(T3.ProductID) FROM ShipMethod AS T1 INNER JOIN PurchaseOrderHeader AS T2 ON T1.ShipMethodID = T2.ShipMethodID INNER JOIN PurchaseOrderDetail AS T3 ON T2.PurchaseOrderID = T3.PurchaseOrderID; |
[INST] Here is a database schema:
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate ... | SELECT T2.Name FROM SalesTerritory AS T1 INNER JOIN StateProvince AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode INNER JOIN SalesTaxRate AS T3 ON T2.StateProvinceID = T3.StateProvinceID ORDER BY (T1.SalesYTD - T1.SalesLastYear) / T1.SalesLastYear DESC LIMIT 1; |
[INST] Here is a database schema:
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many employees earn their salaries on a monthly basis at an hourly ra... | SELECT COUNT(BusinessEntityID) FROM EmployeePayHistory WHERE rate * PayFrequency > 50; |
[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... | SELECT FirstName, MiddleName, LastName FROM Person WHERE BusinessEntityID = 1 AND PersonType = 'EM'; |
[INST] Here is a database schema:
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
... | SELECT NAME FROM Vendor WHERE BusinessEntityID = 1492; |
[INST] Here is a database schema:
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [... | SELECT COUNT(*) FROM ProductVendor WHERE MinOrderQty > 500 AND MaxOrderQty < 15000; |
[INST] Here is a database schema:
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the departments that are part of the Executive General and Administration group. [/INST] [/INST... | SELECT Name FROM Department WHERE GroupName = 'Executive General and Administration'; |
[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... | SELECT LastName FROM Person WHERE PersonType = 'EM' AND MiddleName LIKE 'C%'; |
[INST] Here is a database schema:
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [... | SELECT COUNT(DISTINCT BusinessEntityID) FROM ProductVendor WHERE AverageLeadTime = 25; |
[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: Please list any 3 product numbers with t... | SELECT ProductID FROM ProductCostHistory ORDER BY StandardCost ASC LIMIT 3; |
[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 ]
W... | SELECT COUNT(ProductID) FROM Product WHERE FinishedGoodsFlag = 0 AND Color = 'Black'; |
[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 ]
HireDat... | SELECT JobTitle FROM Employee ORDER BY SickLeaveHours DESC LIMIT 3; |
[INST] Here is a database schema:
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question... | SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID = 11906; |
[INST] Here is a database schema:
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [... | SELECT LastReceiptCost - StandardPrice FROM ProductVendor WHERE BusinessEntityID = 1580; |
[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 ]
W... | SELECT ListPrice - StandardCost FROM Product WHERE ProductID = 740; |
[INST] Here is a database schema:
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement ... | SELECT ReviewerName FROM ProductReview WHERE Rating = 5; |
[INST] Here is a database schema:
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
... | SELECT BusinessEntityID FROM Vendor WHERE CreditRating = ( SELECT CreditRating FROM Vendor ORDER BY CreditRating 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... | SELECT T1.FirstName, T2.BirthDate FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.BusinessEntityID = 18; |
[INST] Here is a database schema:
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.Contac... | SELECT T1.Name FROM ContactType AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.ContactTypeID = T2.ContactTypeID WHERE T2.BusinessEntityID = 332; |
[INST] Here is a database schema:
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list 3 businesses along with their IDs that use cellphones. [/INST] [/INST] | SELECT T2.BusinessEntityID FROM PhoneNumberType AS T1 INNER JOIN PersonPhone AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID WHERE T1.Name = 'Cell' LIMIT 3; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion... | SELECT T1.Name FROM Currency AS T1 INNER JOIN CountryRegionCurrency AS T2 ON T1.CurrencyCode = T2.CurrencyCode INNER JOIN CountryRegion AS T3 ON T2.CountryRegionCode = T3.CountryRegionCode WHERE T3.Name = 'Brazil'; |
[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... | SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID WHERE T1.Name = 'Finance'; |
[INST] Here is a database schema:
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
... | SELECT T1.AverageLeadTime, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 USING (businessentityid) WHERE T2.BusinessEntityID = 1496 GROUP BY T1.AverageLeadTime, T2.Name; |
[INST] Here is a database schema:
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinc... | SELECT SUM(IIF(T1.city = 'Bothell', 1, 0)) - SUM(IIF(T1.city = 'Kenmore', 1, 0)) , stateprovincecode FROM Address AS T1 INNER JOIN StateProvince AS T2 ON T1.stateprovinceid = T2.stateprovinceid GROUP BY stateprovincecode; |
[INST] Here is a database schema:
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductM... | SELECT T1.ProductModelID FROM ProductModelProductDescriptionCulture AS T1 INNER JOIN Culture AS T2 USING (cultureid) INNER JOIN ProductDescription AS T3 USING (productdescriptionid) WHERE T3.Description LIKE 'Chromoly steel%' AND T2.Name = 'English'; |
[INST] Here is a database schema:
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate ... | SELECT T1.BusinessEntityID, T2.'Group' FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 USING (territoryid) WHERE T1.CommissionPct >= 0.018; |
[INST] Here is a database schema:
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the various phone number types in the following order, from most to least common among businesses. [/INS... | SELECT T2.Name FROM PersonPhone AS T1 INNER JOIN PhoneNumberType AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID GROUP BY T2.Name ORDER BY COUNT(T2.Name) DESC; |
[INST] Here is a database schema:
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.Contac... | SELECT T1.Name FROM ContactType AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.ContactTypeID = T2.ContactTypeID GROUP BY T1.Name ORDER BY COUNT(T1.Name) 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... | SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SP'; |
[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... | SELECT T2.JobTitle FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Suchitra'; |
[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... | SELECT COUNT(T1.BusinessentityID) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'EM' AND T2.MaritalStatus = 'S'; |
[INST] Here is a database schema:
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDes... | SELECT SUM(CASE WHEN T1.Name = 'English' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.Name = 'Arabic' THEN 1 ELSE 0 END) FROM Culture AS T1 INNER JOIN ProductModelProductDescriptionCulture AS T2 ON T1.CultureID = T2.CultureID WHERE T1.Name = 'English' OR T1.Name = 'Arabic'; |
[INST] Here is a database schema:
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTyp... | SELECT T1.AddressLine1 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 USING (AddressID) WHERE T2.BusinessEntityID = 1; |
[INST] Here is a database schema:
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTyp... | SELECT T2.BusinessEntityID FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T1.City = 'Duvall'; |
[INST] Here is a database schema:
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDes... | SELECT CAST(SUM(CASE WHEN T1.Name = 'Thai' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.CultureID) FROM Culture AS T1 INNER JOIN ProductModelProductDescriptionCulture AS T2 ON T1.CultureID = T2.CultureID; |
[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... | SELECT CAST(SUM(CASE WHEN T2.Gender = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessentityID) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessentityID = T2.BusinessentityID WHERE T1.PersonType = 'EM'; |
[INST] Here is a database schema:
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinc... | SELECT T2.City, T1.Name, T1.IsOnlyStateProvinceFlag FROM StateProvince AS T1 INNER JOIN Address AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.AddressID = 15873; |
[INST] Here is a database schema:
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTyp... | SELECT T1.AddressLine1, T1.AddressLine2 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T2.BusinessEntityID = 24; |
[INST] Here is a database schema:
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: Which year is credit card No.9648's Expiration Year? [/INST] ... | SELECT ExpYear FROM CreditCard WHERE CreditCardID = 9648; |
[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... | SELECT BusinessEntityID FROM Person WHERE FirstName = 'Emma' AND LastName = 'Harris'; |
[INST] Here is a database schema:
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 is the location id for Debur and Polish? [/INST] [/INST] | SELECT LocationID FROM Location WHERE Name = 'Debur and Polish'; |
[INST] Here is a database schema:
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What are the Department ids under the Sales and Marketing Group? [/INST] [/INST] | SELECT DepartmentID FROM Department WHERE GroupName = 'Sales and Marketing'; |
[INST] Here is a database schema:
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ... | SELECT BusinessEntityID FROM SalesPerson WHERE SalesLastYear = '1635823.3967'; |
[INST] Here is a database schema:
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the Shift start time for Shift ID No.2? [/INST] [/INST] | SELECT StartTime FROM Shift WHERE ShiftID = '2'; |
[INST] Here is a database schema:
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is contact Type ID No.16 represent for? [/INST] [/INST] | SELECT Name FROM ContactType WHERE ContactTypeID = '16'; |
[INST] Here is a database schema:
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the minimum shipping charge for "OVERSEAS - DELUXE"? [/INST] [/IN... | SELECT ShipBase FROM ShipMethod WHERE Name = 'OVERSEAS - DELUXE'; |
[INST] Here is a database schema:
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please tell the meaning of CultureID "fr". [/INST] [/INST] | SELECT Name FROM Culture WHERE CultureID = 'fr'; |
[INST] Here is a database schema:
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Give the Mauritius Rupee's currency code. [/INST] [/INST] | SELECT CurrencyCode FROM Currency WHERE Name = 'Mauritius Rupee'; |
[INST] Here is a database schema:
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Name cellphone number's Type ID? [/INST] [/INST] | SELECT PhoneNumberTypeID FROM PhoneNumberType WHERE Name = 'Cell'; |
[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 ]
HireDat... | SELECT BirthDate FROM Employee WHERE HireDate = '2008-12-07'; |
[INST] Here is a database schema:
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INT... | SELECT T1.Name FROM Product AS T1 INNER JOIN ProductModel AS T2 ON T1.ProductModelID = T2.ProductModelID WHERE T1.ProductID = 793; |
[INST] Here is a database schema:
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTE... | SELECT T2.UnitMeasureCode FROM Product AS T1 INNER JOIN UnitMeasure AS T2 ON T1.SizeUnitMeasureCode = T2.UnitMeasureCode OR T1.WeightUnitMeasureCode = T2.UnitMeasureCode WHERE T1.ProductID = 762 GROUP BY T1.ProductID, T2.UnitMeasureCode; |
[INST] Here is a database schema:
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTyp... | SELECT AddressLine1, AddressLine2 FROM Address WHERE AddressID IN ( SELECT AddressID FROM BusinessEntityAddress WHERE BusinessEntityID = 4 ); |
[INST] Here is a database schema:
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ I... | SELECT T2.Name FROM BillOfMaterials AS T1 INNER JOIN UnitMeasure AS T2 ON T1.UnitMeasureCode = T2.UnitMeasureCode WHERE T1.ComponentID = 494 AND T1.EndDate IS NULL GROUP BY T2.name; |
[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 ]
HireDat... | SELECT COUNT(T2.BusinessEntityID) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.BirthDate = '1975-12-25' AND T1.DocumentSummary IS NULL; |
[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 ]
F... | SELECT T1.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ListPrice - T1.StandardCost > 21.9037 AND STRFTIME('%Y-%m-%d', T2.StartDate) >= '2012-10-01'; |
[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
ProductP... | SELECT T1.ThumbNailPhoto FROM ProductPhoto AS T1 INNER JOIN ProductProductPhoto AS T2 ON T1.ProductPhotoID = T2.ProductPhotoID WHERE T2.ProductID = 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... | SELECT LENGTH(T2.PasswordHash) FROM Person AS T1 INNER JOIN Password AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Catherine' AND T1.LastName = 'Ward'; |
[INST] Here is a database schema:
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] p... | SELECT T1.Rating FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ReviewerName = 'Jill' AND T2.Name = 'HL Mountain Pedal'; |
[INST] Here is a database schema:
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [... | SELECT T1.LastReceiptCost - T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Freewheel'; |
[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... | SELECT T1.Bonus FROM SalesPerson AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.FirstName = 'Rachel' AND T2.LastName = 'Valdez'; |
[INST] Here is a database schema:
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] prima... | SELECT COUNT(DISTINCT T1.Name) FROM SalesTaxRate AS T1 INNER JOIN StateProvince AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T2.Name = 'Quebec'; |
[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... | SELECT T2.EmailAddress FROM Person AS T1 INNER JOIN EmailAddress AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Kevin' AND T1.MiddleName = 'A' AND T1.LastName = 'Wright'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid... | SELECT T1.CountryRegionCode FROM StateProvince AS T1 INNER JOIN CountryRegion AS T2 ON T1.CountryRegionCode = T2.CountryRegionCode WHERE T2.Name = 'France' AND T1.IsOnlyStateProvinceFlag = 1; |
[INST] Here is a database schema:
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]... | SELECT T1.TransactionType FROM TransactionHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Road Frame - Black, 48' AND STRFTIME('%Y-%m-%d',T1.TransactionDate) = '2013-07-31'; |
[INST] Here is a database schema:
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Product :
Produ... | SELECT T1.TransactionType FROM TransactionHistoryArchive AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'LL Road Handlebars' AND STRFTIME('%Y-%m-%d',T1.TransactionDate) = '2012-11-03'; |
[INST] Here is a database schema:
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
... | SELECT T1.CreditRating FROM Vendor AS T1 INNER JOIN BusinessEntity AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.rowguid = '33671A4E-DF2B-4879-807B-E3F930DD5C0C'; |
[INST] Here is a database schema:
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
... | SELECT T1.PreferredVendorStatus FROM Vendor AS T1 INNER JOIN BusinessEntity AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.rowguid = '684F328D-C185-43B9-AF9A-37ACC680D2AF'; |
[INST] Here is a database schema:
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.Contac... | SELECT T1.ActiveFlag FROM Vendor AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonID = 2054; |
[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... | SELECT T2.PhoneNumber FROM Person AS T1 INNER JOIN PersonPhone AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Gerald' AND T1.LastName = 'Patel'; |
[INST] Here is a database schema:
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which is Business Entity ID No.13626's phone number type? [/INST] [/INST] | SELECT T2.Name FROM PersonPhone AS T1 INNER JOIN PhoneNumberType AS T2 USING (PhoneNumberTypeID) WHERE T1.BusinessEntityID = 13626; |
[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... | SELECT T2.JobTitle FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Lynn' AND T1.MiddleName = 'N' AND T1.LastName = 'Tsoflias'; |
[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
... | SELECT COUNT(*) FROM ProductCategory AS T1 INNER JOIN ProductSubcategory AS T2 ON T1.ProductCategoryID = T2.ProductCategoryID WHERE T1.Name = 'Bikes'; |
[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 ]
HireDat... | SELECT CAST(SUM(CASE WHEN T1.DocumentSummary IS NOT NULL THEN 1 ELSE 0 END) AS REAL) / COUNT(T1.DocumentSummary) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Assistant' AND T2.HireDate = '2009-01-22'; |
[INST] Here is a database schema:
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [... | SELECT (T1.LastReceiptCost - T1.StandardPrice) / T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Grip Tape'; |
[INST] Here is a database schema:
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: For all phone numbers, what percentage of the total is cell phone? [/INST] [/INST] | SELECT CAST(SUM(CASE WHEN T2.Name = 'Cell' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Name) FROM PersonPhone AS T1 INNER JOIN PhoneNumberType AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID; |
[INST] Here is a database schema:
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement... | SELECT ProductAssemblyID FROM BillOfMaterials WHERE UnitMeasureCode = 'EA' AND BOMLevel = 2 AND PerAssemblyQty > 10; |
[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 ]
Act... | SELECT COUNT(LocationID) FROM WorkOrderRouting WHERE ActualResourceHrs = 2; |
[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.ScrapRe... | SELECT COUNT(*) FROM WorkOrderRouting AS T1 INNER JOIN BillOfMaterials AS T2 ON T1.LocationID = T2.ProductAssemblyID INNER JOIN WorkOrder AS T3 ON T3.WorkOrderID = T1.WorkOrderID WHERE T1.LocationID = 40; |
[INST] Here is a database schema:
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ I... | SELECT SUM(T1.PerAssemblyQty), T2.Name FROM BillOfMaterials AS T1 INNER JOIN UnitMeasure AS T2 ON T1.UnitMeasureCode = T2.UnitMeasureCode WHERE T1.UnitMeasureCode IN ('EA', 'IN', 'OZ') GROUP BY T2.Name; |
[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.ScrapRe... | SELECT ProductID FROM Product WHERE ProductID NOT IN ( SELECT T1.ProductID FROM Product AS T1 INNER JOIN WorkOrder AS T2 ON T1.ProductID = T2.ProductID ); |
[INST] Here is a database schema:
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]... | SELECT ProductID FROM Product WHERE ProductID IN ( SELECT ProductID FROM TransactionHistory WHERE TransactionType = 'P' ); |
[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... | SELECT T2.FirstName, T2.MiddleName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle = 'Accountant'; |
[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... | SELECT T1.JobTitle FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.FirstName = 'Ken' AND T2.MiddleName = 'J' AND T2.LastName = 'Sánchez'; |
[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... | SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 0 AND T1.Gender = 'M'; |
[INST] Here is a database schema:
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ... | SELECT BusinessEntityID FROM SalesPerson WHERE BusinessEntityID IN ( SELECT BusinessEntityID FROM SalesPersonQuotaHistory WHERE STRFTIME('%Y', QuotaDate) = '2013' ) ORDER BY CAST(SalesLastYear AS REAL) / SalesQuota 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... | SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'EM' AND T1.MaritalStatus = 'M'; |
[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... | SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' AND T1.MaritalStatus = 'S' AND T2.PersonType = 'VC'; |
[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... | SELECT SUM(T1.SickLeaveHours) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 0; |
[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... | SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP' AND SUBSTR(T1.HireDate, 0, 4) < 2010; |
[INST] Here is a database schema:
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ... | SELECT T1.BusinessEntityID, SUM(T1.SalesQuota) FROM SalesPerson AS T1 INNER JOIN SalesPersonQuotaHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T2.QuotaDate) = '2011' GROUP BY T1.BusinessEntityID ORDER BY SUM(T1.SalesYTD) DESC LIMIT 1; |
[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... | SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.FirstName = 'Alex' AND T1.MaritalStatus = 'S' AND T1.OrganizationLevel = 1; |
[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... | SELECT CAST(SUM(T1.VacationHours) AS REAL) / COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP'; |
[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... | SELECT T1.LastName, T3.JobTitle FROM Person AS T1 INNER JOIN Document AS T2 ON T1.BusinessEntityID = T2.Owner INNER JOIN Employee AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T2.Title = 'Crank Arm and Tire Maintenance'; |
[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... | SELECT COUNT(T3.BusinessEntityID) FROM ( SELECT T1.BusinessEntityID FROM Employee AS T1 INNER JOIN Person AS T2 USING (BusinessEntityID) WHERE T2.Suffix IS NULL GROUP BY T1.BusinessEntityID ) AS T3; |
[INST] Here is a database schema:
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ... | SELECT DISTINCT T1.BusinessEntityID FROM SalesPerson AS T1 INNER JOIN SalesPersonQuotaHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.TerritoryID = 1 AND STRFTIME('%Y', QuotaDate) = '2013'; |
[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... | SELECT T3.LastName FROM Employee AS T1 INNER JOIN JobCandidate AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Person AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T1.BusinessEntityID IN (212, 274); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.