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: List down the email address of female single employees. [/INST] | SELECT T3.EmailAddress FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmailAddress AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.Gender = 'F' AND T1.MaritalStatus = 'S'; |
[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 color of products that were reviewed? [/INST] | SELECT T1.Color FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 709 OR 937 OR 798; |
[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 projected sales quota amount in 2013 and sales YTD amount for sales person with business entity ID 275? [/INST] | SELECT SUM(T1.SalesQuota) FROM SalesPerson AS T1 INNER JOIN SalesPersonQuotaHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.BusinessEntityID = 275 AND STRFTIME('%Y', QuotaDate) = '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: Provide the business entity ID who did not achieved projected yearly sales quota in 2013. [/INST] | SELECT DISTINCT T1.BusinessEntityID FROM SalesPerson AS T1 INNER JOIN SalesPersonQuotaHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T2.QuotaDate) = '2013' AND T1.SalesQuota < T1.SalesLastYear; |
[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 wish to receive e-mail promotion from AdventureWorks, how many percent of them are female? [/INST] | SELECT CAST(SUM(CASE WHEN T1.Gender = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 1; |
[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 times is married non sales employees against single non-sales employees? [/INST] | SELECT CAST(SUM(CASE WHEN T1.MaritalStatus = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T1.MaritalStatus = 'S' THEN 1 ELSE 0 END) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'EM'; |
[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 total bonus received by sales person and what is the percentage of it against the projected yearly sales quota in 2013? [/INST] | SELECT SUM(T1.Bonus) , CAST(SUM(T1.Bonus) AS REAL) * 100 / SUM(T1.SalesQuota) FROM SalesPerson AS T1 INNER JOIN SalesPersonQuotaHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T2.QuotaDate) = '2013'; |
[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 types of credit cards are there and how many are vista? [/INST] | SELECT COUNT(CardNumber) FROM CreditCard WHERE CardType = 'vista'; |
[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 id "475"? [/INST] | SELECT Name FROM Product WHERE ProductID = 475; |
[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 born before 1980 , how many of them are single? [/INST] | SELECT COUNT(BusinessEntityID) FROM Employee WHERE MaritalStatus = 's' AND BirthDate < '1980-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: List all the names of the stores assigned to the sales person with the id "277". [/INST] | SELECT Name FROM Store WHERE SalesPersonID = 277; |
[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 with the id "989" were sold in August 2013? [/INST] | SELECT SUM(Quantity) FROM TransactionHistory WHERE TransactionDate LIKE '2013-08%' AND TransactionType = 'S' AND ProductID = 989; |
[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 of the credit cards that had expired by 2007. [/INST] | SELECT CardNumber FROM CreditCard WHERE 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: List all the pay rates of all employees that were hired at 20 years of age. [/INST] | SELECT T2.Rate FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE STRFTIME('%Y', T1.HireDate) - STRFTIME('%Y', T1.BirthDate) = 20; |
[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 territory assigned to the sales person with business id "277"? [/INST] | SELECT T2.Name FROM SalesPerson AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.BusinessEntityID = 277; |
[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 Vice President of Production? [/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 = 'Vice President of Production'; |
[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 in the Information Service department work the evening shift? [/INST] | SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID INNER JOIN Shift AS T3 ON T2.ShiftId = T3.ShiftId WHERE T1.Name = 'Information Services' AND T3.Name = 'Evening'; |
[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 purchase order ids of the vendor with a below average rating. [/INST] | SELECT T2.PurchaseOrderID FROM Vendor AS T1 INNER JOIN PurchaseOrderHeader AS T2 ON T1.BusinessEntityID = T2.VendorID WHERE T1.CreditRating = 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: Is the phone number "114-555-0100" a work number or a home number? [/INST] | SELECT T2.Name FROM PersonPhone AS T1 INNER JOIN PhoneNumberType AS T2 ON T1.PhoneNumberTypeID = T2.PhoneNumberTypeID WHERE T1.PhoneNumber = '114-555-0100'; |
[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 total shipment by "cargo transport 5" cost of all purchase orders created on 12/14/2011? [/INST] | SELECT SUM(t2.freight) FROM ShipMethod AS t1 INNER JOIN PurchaseOrderHeader AS t2 ON t1.shipmethodid = t2.shipmethodid WHERE t1.name = 'cargo transport 5' AND t2.orderdate = '2011-12-14'; |
[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 sales orders did the salesperson David R. Campbell create? [/INST] | SELECT COUNT(T2.TotalDue) FROM Person AS T1 INNER JOIN SalesOrderHeader AS T2 ON T1.ModifiedDate = T2.DueDate WHERE T1.FirstName = 'David' AND T1.MiddleName = 'R' AND T1.LastName = 'Campbell' AND T1.PersonType = 'SP'; |
[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 email address of the Facilities Manager? [/INST] | SELECT T3.EmailAddress FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmailAddress AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.JobTitle = 'Facilities Manager'; |
[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 customers are there in Canada? [/INST] | SELECT COUNT(T2.CustomerID) FROM SalesTerritory AS T1 INNER JOIN Customer AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.Name = 'Canada'; |
[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 shipping address for the sales order "43873"? [/INST] | SELECT T1.ShipToAddressID FROM SalesOrderHeader AS T1 INNER JOIN Address AS T2 ON T1.BillToAddressID = T2.AddressID WHERE T1.SalesOrderID = 43873 GROUP BY T1.ShipToAddressID; |
[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 first names of the people with more than 65 sick leave hours. [/INST] | SELECT T2.FirstName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.SickLeaveHours > 65; |
[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 all the production technicians, how many have a below average pay rate for a production technician? [/INST] | SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' AND T2.Rate < ( SELECT AVG(T2.Rate) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' ); |
[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 proportion of sales orders are made from the United Kingdom? [/INST] | SELECT CAST(SUM(CASE WHEN T2.Name = 'United Kingdom' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.SalesOrderID) FROM SalesOrderHeader AS T1 INNER JOIN SalesTerritory AS T2 ON T1.TerritoryID = T2.TerritoryID; |
[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 is the modified date of the phone number "1500 555-0143"? [/INST] | SELECT ModifiedDate FROM PersonPhone WHERE PhoneNumber = '1 (11) 500 555-0143'; |
[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 business ID of the person who has made the most sales total year to date? [/INST] | SELECT BusinessEntityID FROM SalesPerson ORDER BY 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 active vendors who offer a purchasing web service. [/INST] | SELECT Name FROM Vendor WHERE 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: Which territory has the most customers as of 9/12/2014? [/INST] | SELECT TerritoryID FROM Customer WHERE ModifiedDate < '2014-12-09' GROUP BY TerritoryID ORDER BY COUNT(TerritoryID) 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 total cost for all the orders placed on 5/29/2013? [/INST] | SELECT SUM(TotalDue) FROM PurchaseOrderHeader WHERE OrderDate LIKE '2013-05-29%'; |
[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 most common first name among the vendor contact? [/INST] | SELECT FirstName FROM Person WHERE PersonType = 'VC' GROUP BY FirstName ORDER BY COUNT(*) 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 the full name of all the 'Production Technician - WC50' [/INST] | SELECT T2.FirstName, T2.MiddleName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 USING (BusinessEntityID) WHERE T1.JobTitle = 'Production Technician - WC50' GROUP BY T2.FirstName, T2.MiddleName, T2.LastName; |
[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 Minipumps have been sold? [/INST] | SELECT COUNT(OrderQty) FROM SalesOrderDetail WHERE ProductID IN ( SELECT ProductID FROM Product WHERE Name = 'Minipump' ); |
[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 person's business ID with a vista credit card number "11113366963373"? [/INST] | SELECT T2.BusinessEntityID FROM CreditCard AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID WHERE T1.CardNumber = 11113366963373; |
[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 does the person with the BusinessEntityID "5555" live? [/INST] | SELECT T3.City, T3.AddressLine1 FROM BusinessEntityAddress AS T1 INNER JOIN AddressType AS T2 ON T1.AddressTypeID = T2.AddressTypeID INNER JOIN Address AS T3 ON T1.AddressID = T3.AddressID WHERE T1.BusinessEntityID = 5555 AND T2.Name = 'Home'; |
[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 names of products with the special offer "15". [/INST] | SELECT T2.Name FROM SpecialOfferProduct AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.SpecialOfferID = 15; |
[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 credit card number for Michelle E Cox? [/INST] | SELECT T3.CreditCardID FROM Person AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN CreditCard AS T3 ON T2.CreditCardID = T3.CreditCardID WHERE T1.FirstName = 'Michelle' AND T1.MiddleName = 'E' AND T1.LastName = 'Cox'; |
[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 reason for sales order "51883"? [/INST] | SELECT T2.Name FROM SalesOrderHeaderSalesReason AS T1 INNER JOIN SalesReason AS T2 ON T1.SalesReasonID = T2.SalesReasonID WHERE T1.SalesOrderID = 51883; |
[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 credit card number for the sales order "45793"? [/INST] | SELECT T2.CardNumber FROM SalesOrderHeader AS T1 INNER JOIN CreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID WHERE T1.SalesOrderID = 45793; |
[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 sales people in the Northwest US. [/INST] | SELECT T2.BusinessEntityID FROM SalesTerritory AS T1 INNER JOIN SalesPerson AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.Name = 'Northwest' AND T1.CountryRegionCode = 'US'; |
[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 Production Technician has the highest pay rate? [/INST] | SELECT T1.BusinessEntityID FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle LIKE 'Production Technician%' ORDER BY T2.Rate DESC LIMIT 1; |
[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 sales person in charge of the territory with the id "9"? Provide their full name. [/INST] | SELECT T2.FirstName, T2.MiddleName, T2.LastName FROM SalesPerson AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.TerritoryID = 9; |
[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 description of the discount for the product with the id "762"? [/INST] | SELECT T2.Description FROM SpecialOfferProduct AS T1 INNER JOIN SpecialOffer AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID WHERE T1.ProductID = 762; |
[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: Compare the average pay rate of male and female employees. [/INST] | SELECT AVG(T2.Rate) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID GROUP BY T1.Gender; |
[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 percentage of employees who work the night shift? [/INST] | SELECT CAST(SUM(CASE WHEN T1.Name = 'Night' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.BusinessEntityID) FROM Shift AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.ShiftId = T2.ShiftId; |
[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 married male employees were born before the year 1960? [/INST] | SELECT COUNT(BusinessEntityID) FROM Employee WHERE MaritalStatus = 'M' AND STRFTIME('%Y', BirthDate) < '1960' AND Gender = 'M'; |
[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 top 5 types of products with the highest selling price? ? [/INST] | SELECT Name FROM Product ORDER BY ListPrice DESC LIMIT 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: When did the company hired its first Accountant? [/INST] | SELECT MIN(HireDate) FROM Employee WHERE JobTitle = 'Accountant'; |
[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: In 2007, which job position was hired the most? [/INST] | SELECT JobTitle FROM Employee WHERE STRFTIME('%Y', HireDate) = '2007' GROUP BY HireDate ORDER BY COUNT(JobTitle) 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 vendor with the highest standard price? If there are two vendors of the same amount, calculate only for one vendor. [/INST] | SELECT LastReceiptCost - StandardPrice FROM ProductVendor ORDER BY 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: How many departments did Sheela Ward work in between 1/1/2011 to 12/31/2012 [/INST] | SELECT COUNT(T3.Name) FROM Person AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Department AS T3 ON T2.DepartmentID = T3.DepartmentID WHERE T1.FirstName = 'Sheela' AND T1.LastName = 'Word' AND STRFTIME('%Y', T3.ModifiedDate) BETWEEN '2011' AND '2012'; |
[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 the sales agents in the company by 12/31/2009? [/INST] | SELECT AVG(2009 - STRFTIME('%Y', T2.BirthDate)) FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SP'; |
[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: To which group does the department with the least amount of workers belong to? Indicate the name of the department as well. [/INST] | SELECT T2.GroupName FROM EmployeeDepartmentHistory AS T1 INNER JOIN Department AS T2 ON T1.DepartmentID = T2.DepartmentID GROUP BY T2.GroupName ORDER BY COUNT(T1.BusinessEntityID) LIMIT 1; |
[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 age of the oldest Marketing Specialist by 12/31/2015 and what is his/her hourly rate? [/INST] | SELECT 2015 - STRFTIME('%Y', T1.BirthDate), T2.Rate FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle = 'Marketing Specialist' ORDER BY 2015 - 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 total amount due of all the purchases made by the company to the vendor that has the lowest selling price amount of a single product? Indicate the name of the vendor to which the purchases was made. [/INST] | SELECT T1.UnitPrice, T3.Name FROM PurchaseOrderDetail AS T1 INNER JOIN PurchaseOrderHeader AS T2 ON T1.PurchaseOrderID = T2.PurchaseOrderID INNER JOIN Vendor AS T3 ON T2.VendorID = T3.BusinessEntityID ORDER BY T1.UnitPrice LIMIT 1; |
[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 made the purchase order with the greatest total due before freight? Indicate her employee ID and calculate for his/her age when he/she was hired. [/INST] | SELECT T2.BusinessEntityID, STRFTIME('%Y', T2.HireDate) - STRFTIME('%Y', T2.BirthDate) FROM PurchaseOrderHeader AS T1 INNER JOIN Employee AS T2 ON T1.EmployeeID = T2.BusinessEntityID ORDER BY T1.TotalDue DESC LIMIT 1; |
[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 position of the employee with the 10th highest salary? Indicate his/her salary amount and his/her full name. [/INST] | SELECT T2.JobTitle, T1.Rate, T3.FirstName, T3.MiddleName, T3.LastName FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Person AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID ORDER BY T1.Rate DESC LIMIT 9, 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 of a single product that received the highest rating from John Smith? List the product/s' names. [/INST] | SELECT T1.ListPrice - T1.StandardCost, T1.Name FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ReviewerName = 'John Smith' ORDER BY T2.Rating DESC LIMIT 1; |
[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 salary rate per hour that the company paid to the first 5 employees that they hired? [/INST] | SELECT T1.Rate FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Person AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID ORDER BY T2.HireDate ASC 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: Among the vendors with maximum orders betweeen 500 to 750, which vendor has the 10th highest profit on net? [/INST] | SELECT T2.Name FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.MaxOrderQty BETWEEN 500 AND 750 ORDER BY T1.LastReceiptCost - T1.StandardPrice DESC LIMIT 9, 1; |
[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: As of 12/31/2011, how long has the employee assigned to all pending for approval papers been working in the company from the date he was hired? [/INST] | SELECT 2011 - STRFTIME('%Y', T2.HireDate) FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T1.Status = 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: Jill ranked which medium-quality class product as the highest, and how long will it take the company to manufacture such a product? [/INST] | SELECT T1.DaysToManufacture FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Rating = 5 AND T1.Class = 'M' ORDER BY T2.Rating LIMIT 1; |
[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 was the first job position that the company needed, and who was hired? Indicate his/her full name. [/INST] | SELECT T1.JobTitle, T2.FirstName, T2.MiddleName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.HireDate LIMIT 1; |
[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 work orders with quantities ranging from 100 to 250 have a reorder point of no more than 375? [/INST] | SELECT COUNT(T1.TransactionID) FROM TransactionHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Quantity BETWEEN 100 AND 250 AND T2.ReorderPoint <= 375; |
[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 average salary of female employees in comparison to male employees? [/INST] | SELECT AVG(T2.Rate) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Gender = 'F'; |
[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 vendors to which the company purchased its women's tights products? [/INST] | SELECT DISTINCT T4.Name FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID INNER JOIN ProductSubcategory AS T3 ON T1.ProductSubcategoryID = T3.ProductSubcategoryID INNER JOIN Vendor AS T4 ON T2.BusinessEntityID = T4.BusinessEntityID WHERE T1.MakeFlag = 0 AND T1.Style = 'W' AND T3.Name = 'Tights'; |
[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 frequently does the first-ever Scheduling Assistant get paid? [/INST] | SELECT T2.PayFrequency FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.JobTitle = 'Scheduling Assistant' ORDER BY T1.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: What product has the fewest online orders from one customer? List the product's class, line of business, and list price. [/INST] | SELECT T2.Class, T2.ProductLine, T2.ListPrice FROM ShoppingCartItem AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID ORDER BY SUM(Quantity) 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 full name of the sales person who has the the highest commission percent received per sale? [/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.CommissionPct 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 full name of the second oldest person in the company at the time he was hired? [/INST] | SELECT T2.FirstName, T2.MiddleName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY STRFTIME('%Y', T1.HireDate) - STRFTIME('%Y', T1.BirthDate) 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: What is the total profit gained by the company from the product that has the highest amount of quantity ordered from online customers? Indicate the name of the product. [/INST] | SELECT (T2.ListPrice - T2.StandardCost) * SUM(T1.Quantity), T2.Name FROM ShoppingCartItem AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID, T2.Name, T2.ListPrice, T2.StandardCost, T1.Quantity ORDER BY SUM(T1.Quantity) DESC LIMIT 1; |
[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 amount of difference between the ordered quantity and actual quantity received in a single purchase order and to which vendor was the purchase order made? [/INST] | SELECT T2.OrderQty - T2.ReceivedQty, VendorID FROM PurchaseOrderHeader AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.PurchaseOrderID = T2.PurchaseOrderID ORDER BY T2.OrderQty - T2.ReceivedQty DESC LIMIT 1; |
[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 lead time of product ID 843? Calculate for its profit on net and indicate the full location to which the vendor is located. [/INST] | SELECT T1.AverageLeadTime, T1.LastReceiptCost - T1.StandardPrice, T4.AddressLine1, T4.AddressLine2 , T4.City, T4.PostalCode FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN BusinessEntityAddress AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID INNER JOIN Address AS T4 ON T3.AddressID = T4.AddressID WHERE T1.ProductID = 843; |
[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 salespersons haven't met quota? [/INST] | SELECT COUNT(BusinessEntityID) FROM SalesPerson WHERE Bonus = 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 sales with a tax applied to retail transaction, how many of them are charged by multiple types of taxes? [/INST] | SELECT COUNT(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: Please give the highest product cost of a purchase order. [/INST] | SELECT ActualCost FROM TransactionHistory WHERE TransactionType = 'P' ORDER BY ActualCost 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 status of the order with the highest shipping cost? [/INST] | SELECT Status FROM SalesOrderHeader ORDER BY Freight 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 products are out of stock? [/INST] | SELECT COUNT(ProductID) FROM ProductVendor WHERE 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: What is the highest profit on net for a product? [/INST] | SELECT LastReceiptCost - StandardPrice FROM ProductVendor ORDER BY LastReceiptCost - 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: Which reviewer gives the biggest number of the highest rating? [/INST] | SELECT ReviewerName FROM ProductReview WHERE 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: Which product gets the most reviews? [/INST] | SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T1.ProductID ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1; |
[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 are purchased, how many of them have never received the highest rating? [/INST] | SELECT COUNT(T1.ProductID) FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MakeFlag = 0 AND T1.Rating != 5; |
[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 biggest amount of reviews a salable product gets? [/INST] | SELECT T1.Comments FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.FinishedGoodsFlag = 1 GROUP BY T1.Comments 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: Among the products that are both manufactured in house and salable, how many of them get over 10 reviews? [/INST] | SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 USING (ProductID) WHERE T2.FinishedGoodsFlag = 1 AND T2.MakeFlag = 1 GROUP BY T2.Name ORDER BY COUNT(T1.COMMENTS) > 10; |
[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 names of the products that get over 10 reviews and a salable. [/INST] | SELECT T2.NAME FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.FinishedGoodsFlag = 1 GROUP BY T2.NAME ORDER BY COUNT(T1.comments) > 10; |
[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 reviewers who have given the highest rating for a medium class, women's product. [/INST] | SELECT T1.ReviewerName FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'M' AND T2.Style = 'W' AND T1.Rating = 5; |
[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 class of the product with the most reviews? [/INST] | SELECT T2.Class FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T2.Class ORDER BY COUNT(T1.ProductReviewID) DESC LIMIT 1; |
[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 e-mails of the reviewers who have reviewed high class. [/INST] | SELECT T1.EmailAddress FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Class = 'H'; |
[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 names of the products that have over 3 price changes. [/INST] | SELECT T2.Name FROM ProductListPriceHistory AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID GROUP BY T2.Name ORDER BY COUNT(T1.ListPrice) > 3; |
[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 description of Headset Ball Bearings? [/INST] | SELECT T1.Description FROM ProductDescription AS T1 INNER JOIN Product AS T2 WHERE T2.Name = 'Headset Ball Bearings' AND T1.productDescriptionID = T2.ProductID; |
[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 vendor's selling price for Hex Nut 5? [/INST] | SELECT T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Hex Nut 5' ORDER BY T1.StandardPrice DESC LIMIT 1; |
[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 all the vendors' usual selling prices of the product Hex Nut 5. [/INST] | SELECT T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Hex Nut 5' GROUP BY T1.StandardPrice ORDER BY COUNT(T1.StandardPrice) DESC LIMIT 1; |
[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 that sell the product Hex Nut 5, how many of them have a good credit rating? [/INST] | SELECT COUNT(DISTINCT T3.Name) FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T2.Name = 'Hex Nut 5' AND T3.CreditRating = 1 AND 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: Please list the website purchasing links of the vendors from whom the product Hex Nut 5 can be purchased. [/INST] | SELECT T3.PurchasingWebServiceURL FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T2.Name = 'Hex Nut 5'; |
[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's selling price for Hex Nut 5 is the lowest, please give the vendor's name. [/INST] | SELECT T3.Name FROM ProductVendor AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T2.Name = 'Hex Nut 5' ORDER BY T1.StandardPrice LIMIT 1; |
[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 high-class products are sold by preferred vendors? [/INST] | SELECT COUNT(T2.Name) FROM ProductVendor AS T1 INNER JOIN Product AS T2 USING (ProductID) INNER JOIN Vendor AS T3 ON T1.BusinessEntityID = T3.BusinessEntityID WHERE T3.PreferredVendorStatus = 1 AND T2.Class = 'M'; |
[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 give all the list prices of the product LL Fork. [/INST] | SELECT T2.ListPrice FROM Product AS T1 INNER JOIN ProductListPriceHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'LL Fork'; |
[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 from the mountain product line, how many of them are sold by over 2 vendors? [/INST] | SELECT SUM(CASE WHEN T1.ProductLine = 'M' THEN 1 ELSE 0 END) FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Vendor AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID GROUP BY T1.ProductID HAVING COUNT(T1.Name) > 2; |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.