input
stringlengths 358
16.1k
| output
stringlengths 24
805
|
---|---|
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the products that get over at least 1 review, how many of them are from the mountain product line? [/INST] | SELECT SUM(CASE WHEN T2.ProductLine = 'M' THEN 1 ELSE 0 END) FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID HAVING COUNT(T1.ProductReviewID) > 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the email adresses of the reviewers who have given the lowest rating to the product HL Mountain Pedal. [/INST] | SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'HL Mountain Pedal' ORDER BY T1.Rating LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many products that take more than 2 days to make are out of stock? [/INST] | SELECT COUNT(T2.ProductID) FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.OnOrderQty IS NULL OR T1.OnOrderQty = 0; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the products that are out of stock and purchased in house. [/INST] | SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 0 AND (T1.OnOrderQty IS NULL OR T1.OnOrderQty = 0); |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the salable products from the mountain product line, how many of them have the most reviews? [/INST] | SELECT SUM(CASE WHEN T2.ProductLine = 'M' THEN 1 ELSE 0 END) FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.FinishedGoodsFlag = 1 GROUP BY T1.ProductID ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the average selling price of different vendors of the product Hex Nut 5? [/INST] | SELECT SUM(T1.StandardPrice) / COUNT(T1.BusinessEntityID) FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Hex Nut 5'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the product that has the highest average rating from the mountain product line? [/INST] | SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ProductLine = 'M' GROUP BY T2.Name ORDER BY CAST(SUM(T1.Rating) AS REAL) / COUNT(T1.ProductID) DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the top 3 house-manufactured products with the highest average rating. [/INST] | SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 1 GROUP BY T2.Name ORDER BY SUM(T1.Rating) DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List all the non-sales employees in ascending order of its business entitty ID. [/INST] | SELECT FirstName, LastName FROM Person WHERE PersonType = 'EM' ORDER BY BusinessEntityID; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Name all person in the individual retail whose last name is 'Anderson'. [/INST] | SELECT FirstName, MiddleName, LastName FROM Person WHERE LastName = 'Anderson' AND PersonType = 'IN'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List the name of employees who had left the company? When were they hired? [/INST] | SELECT T1.FirstName, T1.LastName, T2.HireDate FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmployeeDepartmentHistory AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T3.EndDate IS NOT NULL; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Name all salaried employee who are hired in 2007 and later. [/INST] | SELECT T1.FirstName, T1.LastName FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T2.HireDate) >= '2007' AND T2.SalariedFlag = 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List the name of married employees with less than 20 vacation hours. [/INST] | SELECT T1.FirstName, T1.LastName FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.MaritalStatus = 'M' AND T2.VacationHours < 20; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Name the oldest employee who is working on night shift. How old is the employee? [/INST] | SELECT T1.FirstName, T1.LastName , STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', BirthDate) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmployeeDepartmentHistory AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T3.ShiftId = 3 ORDER BY STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', BirthDate) DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List all staff in the Shipping and Receiving department who are hired in 2009. [/INST] | SELECT T1.FirstName, T1.LastName FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmployeeDepartmentHistory AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID INNER JOIN Department AS T4 ON T3.DepartmentID = T4.DepartmentID WHERE STRFTIME('%Y', T2.HireDate) = '2009' AND T4.Name = 'Shipping and Receiving'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the job title of the oldest employee in the company? In which department is he in? [/INST] | SELECT T2.JobTitle, T4.Name FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmployeeDepartmentHistory AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID INNER JOIN Department AS T4 ON T3.DepartmentID = T4.DepartmentID ORDER BY T2.HireDate LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Based on the lastet payrate of each employee, calculate the average hourly payrate for each department. [/INST] | SELECT AVG(T1.Rate) FROM EmployeePayHistory AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Department AS T3 ON T2.DepartmentID = T3.DepartmentID WHERE T1.RateChangeDate = ( SELECT MAX(T1.RateChangeDate) FROM EmployeePayHistory AS T1 INNER JOIN Department AS T2 ON T1.BusinessEntityID = T2.DepartmentID ); |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Other than the Chief Executive Officer, who is the employee who has the highest payrate? State the rate. [/INST] | SELECT T2.FirstName, T2.LastName FROM EmployeePayHistory AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Employee AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T3.JobTitle NOT LIKE 'Chief Executive Officer' ORDER BY T1.Rate DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Name the vendor who has the shortest average lead time for Product ID 319. [/INST] | SELECT T1.Name FROM Vendor AS T1 INNER JOIN ProductVendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.ProductID = 319 ORDER BY T2.AverageLeadTime LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List all product name from Australia Bike Retailer order by product ID. [/INST] | SELECT T3.Name FROM Vendor AS T1 INNER JOIN ProductVendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Product AS T3 ON T2.ProductID = T3.ProductID WHERE T1.Name = 'Australia Bike Retailer'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which vendor gives the best profit on net for product ID 342? [/INST] | SELECT T1.Name FROM Vendor AS T1 INNER JOIN ProductVendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.ProductID = 342 ORDER BY T2.LastReceiptCost - T2.StandardPrice DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the current payrate of Rob Walters? Calculate the percentage increment from his previous payrate. [/INST] | SELECT T2.Rate , (MAX(T2.Rate) - MIN(T2.Rate)) * 100 / MAX(T2.Rate) FROM Person AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.FirstName = 'Rob' AND T1.LastName = 'Walters'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Calculate the average length of employment for employee working in the Research and Development deparment. [/INST] | SELECT AVG(STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', T1.HireDate)) FROM Employee 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 = 'Research and Development'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the average age of employee in Adventure Works? [/INST] | SELECT AVG(STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', BirthDate)) FROM Employee; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the employees in Adventure Works, calculate the percentage of them working as sales representatives. [/INST] | SELECT CAST(SUM(CASE WHEN JobTitle = 'Sales Representative' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(BusinessEntityID) FROM Employee; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please provide contact details of all Marketing Managers. State their name and phone number. [/INST] | SELECT T1.FirstName, T1.LastName, T2.PhoneNumber FROM Person AS T1 INNER JOIN PersonPhone AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Employee AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T3.JobTitle = 'Marketing Manager'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List the person who owns a distinguish credt card. [/INST] | SELECT T3.FirstName, T3.LastName FROM CreditCard AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID INNER JOIN Person AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.CardType = 'Distinguish'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Name the sales person for store Area Bike Accessories. Which territory is he / she in? [/INST] | SELECT T4.Name FROM Store AS T1 INNER JOIN SalesPerson AS T2 ON T1.SalesPersonID = T2.BusinessEntityID INNER JOIN Person AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID INNER JOIN SalesTerritory AS T4 ON T2.TerritoryID = T4.TerritoryID WHERE T1.Name = 'Area Bike Accessories'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Name all stores and its sales representative in France territory. [/INST] | SELECT T3.Name, T4.FirstName, T4.LastName FROM SalesTerritory AS T1 INNER JOIN Customer AS T2 ON T1.TerritoryID = T2.TerritoryID INNER JOIN Store AS T3 ON T2.StoreID = T3.BusinessEntityID INNER JOIN Person AS T4 ON T2.PersonID = T4.BusinessEntityID WHERE T1.Name = 'France'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Name all products that started selling in 2013. State its respective vendor's name. [/INST] | SELECT T1.Name, T3.Name FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE STRFTIME('%Y', T1.SellStartDate) = '2013'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Names the Sales Representative with the highest year to date sales. [/INST] | SELECT T2.FirstName, T2.MiddleName, T2.LastName FROM SalesPerson AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.SalesYTD DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List all product only MOQ of 1,000 and with standard cost more than 17. [/INST] | SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T1.MaxOrderQty = 1000 AND T2.StandardCost > 17; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Who is the oldest married male? State his job title. [/INST] | SELECT T2.FirstName, T2.LastName, T1.JobTitle FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Gender = 'M' AND T1.MaritalStatus = 'M' ORDER BY T1.BirthDate LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: State the vendor for product number WB-H098. [/INST] | SELECT T3.Name FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.ProductNumber = 'WB-H098'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Find the vendor with the least average lead time for Product ID 348. [/INST] | SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.ProductID = 348 ORDER BY T1.AverageLeadTime ASC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: State the employee who are born in or after 1970 and with the least sick leave hour. [/INST] | SELECT T2.FirstName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T1.BirthDate) > '1970' ORDER BY T1.SickLeaveHours LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Calculate the average age of employee in each department and state which department has the youngest employees. [/INST] | SELECT STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', T1.BirthDate) + 1 , T3.Name FROM Employee AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 USING (BusinessEntityID) INNER JOIN Department AS T3 USING (DepartmentID) ORDER BY T1.BirthDate DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please provide the IDs of any three AdventureWorks product subcategories. [/INST] | SELECT DISTINCT ProductCategoryID FROM ProductSubcategory LIMIT 3; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What are the differences between the 288th salesperson's predicted annual sales and his or her actual sales thus far? [/INST] | SELECT SalesYTD - SalesQuota FROM SalesPerson WHERE BusinessEntityID = 288; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list three businesses with the lowest total sales from last year. [/INST] | SELECT BusinessEntityID FROM SalesPerson ORDER BY SalesLastYear LIMIT 3; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which three sales regions have generated the most revenue thus far? [/INST] | SELECT TerritoryID FROM SalesTerritory ORDER BY SalesYTD DESC LIMIT 3; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What categories of offers qualify for group discounts for resellers? [/INST] | SELECT Type FROM SpecialOffer WHERE Category = 'Reseller'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the highest possible discount rate for 'Excess Inventory'? [/INST] | SELECT DiscountPct FROM SpecialOffer WHERE Type = 'Excess Inventory' ORDER BY DiscountPct DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the difference between the actual manufacturing cost of product number 818 and the estimated manufacturing cost? [/INST] | SELECT PlannedCost - ActualCost FROM WorkOrderRouting WHERE ProductID = 818; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many materials still need to be assembled and have a depth of 2 between each component and their parent product? [/INST] | SELECT COUNT(*) FROM BillOfMaterials WHERE BOMLevel = 2 AND EndDate IS NULL; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many of the approved documents are confidential? [/INST] | SELECT COUNT(DocumentNode) FROM Document WHERE Status = 2 AND DocumentSummary IS NULL; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What are the sales tax records charged by multiple types of tax? [/INST] | SELECT SalesTaxRateID FROM SalesTaxRate WHERE Name LIKE '%+%'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which work order transaction number has the highest product quantity? [/INST] | SELECT TransactionID FROM TransactionHistory WHERE TransactionType = 'W' ORDER BY Quantity DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list any 3 vendors that are not recommended by Adventure Works. [/INST] | SELECT Name FROM Vendor WHERE PreferredVendorStatus = 0 LIMIT 3; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many vendors does Adventure Works still work with but are not preferable? [/INST] | SELECT COUNT(BusinessEntityID) FROM Vendor WHERE PreferredVendorStatus = 0 AND ActiveFlag = 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many employees who began working in 2009 or later had night shifts? [/INST] | SELECT COUNT(T1.BusinessEntityID) FROM EmployeeDepartmentHistory AS T1 INNER JOIN Shift AS T2 ON T1.ShiftId = T2.ShiftId WHERE T2.ShiftId = 3 AND STRFTIME('%Y', T2.StartTime) >= '2009'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which department, altogether, has the most personnel who work the evening shift? [/INST] | SELECT T3.Name FROM EmployeeDepartmentHistory AS T1 INNER JOIN Shift AS T2 ON T1.ShiftId = T2.ShiftId INNER JOIN Department AS T3 ON T1.DepartmentID = T3.DepartmentID WHERE T2.Name = 'Night' GROUP BY T3.Name ORDER BY COUNT(T1.BusinessEntityID) DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many shipments by truck were made? [/INST] | SELECT COUNT(*) FROM ShipMethod AS T1 INNER JOIN SalesOrderHeader AS T2 USING (ShipMethodID) WHERE T1.Name = 'XRQ - TRUCK GROUND'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What are the sales reasons for order 43718? [/INST] | SELECT T2.Name FROM SalesOrderHeaderSalesReason AS T1 INNER JOIN SalesReason AS T2 ON T1.SalesReasonID = T2.SalesReasonID WHERE T1.SalesOrderID = 43718; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What bike subcategories are there? [/INST] | SELECT T1.Name FROM ProductSubcategory AS T1 INNER JOIN ProductCategory AS T2 ON T1.ProductCategoryID = T2.ProductCategoryID WHERE T2.name = 'Bikes'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which sales areas are expected to have the highest yearly sales quota? [/INST] | SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID GROUP BY T1.TerritoryID ORDER BY SUM(T1.SalesQuota) DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What goods were sold to customers in accordance with sales order number 43660? [/INST] | SELECT T1.Name FROM Product AS T1 INNER JOIN SalesOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.SalesOrderID = 43660; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the top 5 products with the most orders. [/INST] | SELECT T1.Name FROM Product AS T1 INNER JOIN SalesOrderDetail AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.Name ORDER BY SUM(T2.OrderQty) DESC LIMIT 0, 5; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Where are the shelves where the down tube product was stored? [/INST] | SELECT T2.Shelf FROM Product AS T1 INNER JOIN ProductInventory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Down Tube'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which address type does "Fun Toys and Bikes" fall under? [/INST] | SELECT T2.Name FROM BusinessEntityAddress AS T1 INNER JOIN AddressType AS T2 ON T1.AddressTypeID = T2.AddressTypeID INNER JOIN Store AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T3.Name = 'Fun Toys and Bikes'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Who is the "Next-Door Bike Store" point of contact? [/INST] | SELECT T1.Name FROM ContactType AS T1 INNER JOIN BusinessEntityContact AS T2 ON T1.ContactTypeID = T2.ContactTypeID INNER JOIN Store AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T3.Name = 'Next-Door Bike Store'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the order reference number for the "Mountain End Caps" product? [/INST] | SELECT T2.ReferenceOrderID FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Mountain End Caps'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the 12th business's first line address? [/INST] | SELECT T1.AddressLine1 FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T2.BusinessEntityID = 12; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list any three businesses with their IDs that are located in Dallas City. [/INST] | SELECT T2.BusinessEntityID FROM Address AS T1 INNER JOIN BusinessEntityAddress AS T2 ON T1.AddressID = T2.AddressID WHERE T1.City = 'Dallas' LIMIT 3; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the name of the state that Racine belongs to? [/INST] | SELECT T2.Name FROM Address AS T1 INNER JOIN StateProvince AS T2 ON T1.StateProvinceID = T2.StateProvinceID WHERE T1.City = 'Racine'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the difference in percentage between the product descriptions written in Arabic and Thai? [/INST] | SELECT CAST(SUM(CASE WHEN T1.Name = 'Arabic' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T1.Name = 'Thai' THEN 1 ELSE 0 END) FROM Culture AS T1 INNER JOIN ProductModelProductDescriptionCulture AS T2 ON T1.CultureID = T2.CultureID; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What percentage of businesses in the Northwest US have forecasted annual sales of above 300,000? [/INST] | SELECT CAST(SUM(CASE WHEN T1.SalesQuota > 300000 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessEntityID) FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T2.CountryRegionCode = 'US' AND T2.Name = 'Northwest'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the Crankarm product's net profit? [/INST] | SELECT T2.LastReceiptCost - T2.StandardPrice FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name LIKE '%Crankarm%'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the name of the product with the almost highest review score? [/INST] | SELECT T1.Name FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Rating = ( SELECT Rating FROM ProductReview ORDER BY Rating DESC LIMIT 1 ); |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the company's second highest salary per hour for employees who are paid monthly? [/INST] | SELECT Rate FROM EmployeePayHistory WHERE PayFrequency = 1 ORDER BY Rate DESC LIMIT 1, 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many Vista cards expired before the year 2007? [/INST] | SELECT COUNT(CreditCardID) FROM CreditCard WHERE CardType = 'Vista' AND ExpYear < 2007; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What time does the company's night shift begin? Indicate the answer in regular form. [/INST] | SELECT StartTime FROM Shift WHERE Name = 'Night'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the weight in pounds of the style that is produced the most by the company? If there are multiple products sharing the same weight, indicate the name of each one of them and their corresponding weights. [/INST] | SELECT Weight FROM Product WHERE WeightUnitMeasureCode = 'LB' GROUP BY Weight ORDER BY COUNT(Style) DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which territory has the greatest difference in sales from previous year to this year? Indicate the difference, as well as the name and country of the region. [/INST] | SELECT SalesLastYear - SalesYTD, Name, CountryRegionCode FROM SalesTerritory ORDER BY SalesLastYear - SalesYTD DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What are the names of the top 6 products that has the biggest size in centimeter and what are its reorder point? [/INST] | SELECT Name, ReorderPoint FROM Product WHERE SizeUnitMeasureCode = 'CM' ORDER BY Size DESC LIMIT 6; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How much is the amount to be paid by the company for the purchase order with the third highest freight amount? [/INST] | SELECT TotalDue FROM PurchaseOrderHeader ORDER BY Freight DESC LIMIT 2, 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What profit will the company gain if they sell 10 items of the product that has the lightest weight? [/INST] | SELECT 10 * (ListPrice - StandardCost) FROM Product WHERE Weight IS NOT NULL ORDER BY Weight LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How much is the tax amount of the purchase order with the biggest tax amount? Indicate the purchase order ID. [/INST] | SELECT TaxAmt, PurchaseOrderID FROM PurchaseOrderHeader ORDER BY TaxAmt DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many person have a projected yearly sales of no more than 50,000? [/INST] | SELECT COUNT(BusinessEntityID) FROM SalesPersonQuotaHistory WHERE SalesQuota < 500000; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the employees who were born before 1969, what is the work shift of the 6th oldest employee? [/INST] | SELECT T3.StartTime, T3.EndTime FROM Employee AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Shift AS T3 ON T2.ShiftId = T3.ShiftId WHERE STRFTIME('%Y', T1.BirthDate) < '1969' ORDER BY T1.BirthDate LIMIT 5, 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which product allows the company to make the highest profit on a single item among those that are the fastest to manufacture? Indicate the rating of the product if there any. [/INST] | SELECT T1.Name, T2.Rating FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T1.DaysToManufacture = ( SELECT DaysToManufacture FROM Product ORDER BY DaysToManufacture LIMIT 1 ) ORDER BY T1.ListPrice - T1.StandardCost DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What are the full names of the sales person whose bonuses are less than 1,000? [/INST] | SELECT T2.FirstName, T2.MiddleName, T2.LastName FROM SalesPerson AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Bonus < 1000; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: When did the Senior Tool Designer, who was 33 years old at the time he was hired, stopped working in the Engineering department? [/INST] | SELECT T2.EndDate FROM Employee AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Department AS T3 ON T2.DepartmentID = T3.DepartmentID WHERE T1.JobTitle = 'Senior Tool Designer' AND STRFTIME('%Y', T1.HireDate) - STRFTIME('%Y', T1.BirthDate) = 33 AND T2.EndDate IS NOT NULL; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the vendors with an average credit rating, what is the overall total due amount of purchases made by the company to the vendor that isn't preferrerd if another vendor is available? [/INST] | SELECT SUM(T2.TotalDue) FROM Vendor AS T1 INNER JOIN PurchaseOrderHeader AS T2 ON T1.BusinessEntityID = T2.VendorID WHERE T1.CreditRating = 4 AND T1.PreferredVendorStatus = 0; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which department has the most number of night shifts? [/INST] | SELECT T3.Name FROM Shift AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.ShiftId = T2.ShiftId INNER JOIN Department AS T3 ON T2.DepartmentID = T3.DepartmentID GROUP BY T2.DepartmentID ORDER BY COUNT(T1.Name = 'Night') DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How much profit can the company gained from selling two high class black Road Bikes with a size of 58? [/INST] | SELECT 2 * (T1.ListPrice - T1.StandardCost) FROM Product AS T1 INNER JOIN ProductSubcategory AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID WHERE T1.Class = 'H' AND T1.Color = 'Black' AND T1.Size = 58 AND T2.Name = 'Road Bikes'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What are the full names of the 10 youngest married male production technicians? [/INST] | SELECT T2.FirstName, T2.MiddleName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' AND T1.Gender = 'M' AND T1.MaritalStatus = 'M' ORDER BY T1.BirthDate DESC LIMIT 10; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the products with an average lead time of 60, which vendor has the highest profit on net? Indicate the credit rating of such vendor. [/INST] | SELECT T2.Name, T2.CreditRating FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.AverageLeadTime = 60 ORDER BY T1.LastReceiptCost - T1.StandardPrice DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the profit on net of the products that have exactly 200 maximum order quantity? Indicate the name of the vendors to which these products were purchased from. [/INST] | SELECT T1.LastReceiptCost - T1.StandardPrice, T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.MaxOrderQty = 200; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the full name of the non-sales employee who made the most number of rejected purchase orders? [/INST] | SELECT T2.FirstName, T2.LastName FROM PurchaseOrderHeader AS T1 INNER JOIN Person AS T2 ON T1.EmployeeID = T2.BusinessEntityID WHERE T2.PersonType = 'EM' AND T1.Status = 3 GROUP BY T2.FirstName, T2.LastName ORDER BY COUNT(T1.PurchaseOrderID) DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What are the names of the vendor with the second lowest minimum order quantity? [/INST] | SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.MaxOrderQty ASC LIMIT 1, 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How much are the minimum orders of the vendors that are no longer used by the company? [/INST] | SELECT T2.MinOrderQty FROM Vendor AS T1 INNER JOIN ProductVendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.ActiveFlag = 0 ORDER BY T2.MinOrderQty LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Of the employees whose vacation hours are no more than 10, what is the age of the oldest employee at the time he/she was hired? Indicate his/her full name. [/INST] | SELECT STRFTIME('%Y', T1.HireDate) - STRFTIME('%Y', T1.BirthDate), T2.FirstName, T2.MiddleName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.VacationHours <= 10 ORDER BY STRFTIME('%Y', T1.HireDate) - STRFTIME('%Y', T1.BirthDate) DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the primary type of all single female employees hired between 1/1/2008 to 12/31/2008? [/INST] | SELECT T2.PersonType FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Gender = 'F' AND T1.MaritalStatus = 'S' AND STRFTIME('%Y-%m-%d', T1.HireDate) BETWEEN '2008-1-1' AND '2008-12-31' GROUP BY T2.PersonType ORDER BY COUNT(T2.PersonType) DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the company's profit on the product that was rated second-highest by David? [/INST] | SELECT T2.ListPrice - T2.StandardCost FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ReviewerName = 'David' ORDER BY T1.Rating DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which geographic area does the city with the second lowest tax rate belongs to? Indicate the name of the state or province as well. [/INST] | SELECT T3.'Group', T2.Name FROM SalesTaxRate AS T1 INNER JOIN StateProvince AS T2 ON T1.StateProvinceID = T2.StateProvinceID INNER JOIN SalesTerritory AS T3 ON T2.TerritoryID = T3.TerritoryID ORDER BY T1.TaxRate LIMIT 1, 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the average profit of all the low class universal road frames? Indicate how many variety of sizes are there and the available colors. [/INST] | SELECT AVG(T1.ListPrice - T1.StandardCost), COUNT(DISTINCT T1.Size) , COUNT(DISTINCT T1.Style) FROM Product AS T1 INNER JOIN ProductSubcategory AS T2 ON T1.ProductSubcategoryID = T2.ProductSubcategoryID WHERE T1.Class = 'L' AND T2.Name = 'Road Frames' GROUP BY T1.Class, T1.Color; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the discount percentage of "LL Road Frame Sale"? [/INST] | SELECT DiscountPct FROM SpecialOffer WHERE Description = 'LL Road Frame Sale'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many discount are of the type "Excess Inventory"? [/INST] | SELECT COUNT(SpecialOfferID) FROM SpecialOffer WHERE Type = 'Excess Inventory'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
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 ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
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 ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
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 [ DATETIME ]
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 ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
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 ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
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 ]
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 ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
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 ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ 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 ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which seasonal discount had the highest discount percentage? [/INST] | SELECT Description FROM SpecialOffer WHERE Type = 'Seasonal Discount' ORDER BY DiscountPct DESC LIMIT 1; |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.