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: For all the products, list the product name and its corresponding start date for the current standard cost. [/INST] | SELECT T1.Name, T2.StartDate FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T2.EndDate IS NULL; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List the products whereby the standard cost is $80 more than previous standard cost in history. [/INST] | SELECT T1.Name FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.StandardCost - T2.StandardCost > 80 GROUP BY T1.Name; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Name all products and total quantity for each item for shopping cart ID 14951. [/INST] | SELECT T1.Name, T2.Quantity FROM Product AS T1 INNER JOIN ShoppingCartItem AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ShoppingCartID = 14951; |
[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 product name with more than 5 quantity in the shopping cart. [/INST] | SELECT T1.Name FROM Product AS T1 INNER JOIN ShoppingCartItem AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 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: For all the purchase order transactions, name all the products with low quality. [/INST] | SELECT DISTINCT T1.Name FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Class = 'L' AND T2.TransactionType = 'P' ORDER BY T1.Name; |
[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 all the transactions whereby the quantiy is more than 10,000 pieces. State the product name and the selling price. [/INST] | SELECT DISTINCT T1.Name, T1.ListPrice FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 10000; |
[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 is a high quality product but with the lowest transacted quantity? [/INST] | SELECT T1.Name FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Class = 'H' ORDER BY T2.Quantity ASC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many transactions are there for product under the Mountain line? [/INST] | SELECT COUNT(T2.TransactionID) FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductLine = '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: How much would be the total sales profit for shopping cart ID 20621 ? [/INST] | SELECT SUM((T1.ListPrice - T1.StandardCost) * T2.Quantity) FROM Product AS T1 INNER JOIN ShoppingCartItem AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ShoppingCartID = 20621; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List all product names that are high in quality. Please also state its selling price. [/INST] | SELECT Name, ListPrice FROM Product WHERE 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: Which product line has the most products that are salable? [/INST] | SELECT ProductLine FROM Product WHERE FinishedGoodsFlag = 1 GROUP BY ProductLine ORDER BY COUNT(FinishedGoodsFlag) 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: Provide details of review from reviewer whose name begin with letter 'J'. State the product ID, rating and comments. [/INST] | SELECT ProductID, Rating, Comments FROM ProductReview WHERE ReviewerName LIKE 'J%'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: State the product name, product line, rating and the selling price of product with the lowest rating. [/INST] | SELECT T1.Name, T1.ProductLine, T2.Rating, T1.ListPrice FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID ORDER BY T2.Rating ASC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Calculate the profit of each products. List all products with more than $100 in profit. [/INST] | SELECT DISTINCT Name FROM Product WHERE ListPrice - StandardCost > 100; |
[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 product name, reviewer name, rating and comments for product under the road line. [/INST] | SELECT T1.Name, T2.ReviewerName, T2.Rating, T2.Comments FROM Product AS T1 INNER JOIN ProductReview AS T2 USING (productID) WHERE T1.ProductLine = 'R'; |
[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 people reviewed for product named HL Mountain Pedal? What is the average rating? [/INST] | SELECT COUNT(T1.ProductID), AVG(T2.Rating) FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'HL Mountain Pedal'; |
[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 purchase order whereby all received quantity were rejected? Name those product. [/INST] | SELECT T1.Name FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.RejectedQty = T2.ReceivedQty AND T2.RejectedQty <> 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 all products without any rejected quantity, which product has the highest line total? State the product name and unit price. [/INST] | SELECT T1.Name, T2.UnitPrice FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.RejectedQty = 0 ORDER BY T2.LineTotal DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List all product names and its product line for all purchase order with order quantity of 5000 or more. [/INST] | SELECT T1.Name, T1.ProductLine FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderQty > 4999; |
[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 ordered quantity for products under the 'Touring' line? [/INST] | SELECT SUM(T2.OrderQty) FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductLine = 'T'; |
[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 low quality product, which product has the highest line total? List the product name and its line total? [/INST] | SELECT T1.Name, T2.LineTotal FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE Class = 'L' ORDER BY OrderQty * UnitPrice 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 has the highest profit on net? State the product name. [/INST] | SELECT T1.Name FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID ORDER BY T2.LastReceiptCost - T2.StandardPrice DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List all products with minimum order quantity of 100 and order them by product name in descending order. [/INST] | SELECT DISTINCT T1.Name FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MinOrderQty = 100 ORDER BY T1.Name DESC; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: List the name and calculate its profit for product with the highest rating in review. [/INST] | SELECT T1.Name, T1.ListPrice - T1.StandardCost FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID 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 total profit all transactions with product ID 827? [/INST] | SELECT SUM((T1.ListPrice - T1.StandardCost) * T2.Quantity) FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 827; |
[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 currency pair's average exchange rate for the day is the highest? [/INST] | SELECT FromCurrencyCode, ToCurrencyCode FROM CurrencyRate ORDER BY AverageRate 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 with the highest unit price were ordered? [/INST] | SELECT OrderQty FROM PurchaseOrderDetail ORDER BY UnitPrice 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: Between Northwest and Southeast of the United States, which territory one recorded the highest amount of sales last year? [/INST] | SELECT Name FROM SalesTerritory WHERE CountryRegionCode = 'US' AND (Name = 'Northwest' OR Name = 'Southeast') ORDER BY SalesLastYear 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 Document Control Manager who is in charge of all Level 1 approved documents? [/INST] | SELECT T1.FirstName, T1.MiddleName, T1.LastName FROM Person AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Document AS T3 ON T3.Owner = T2.BusinessEntityID WHERE T2.JobTitle = 'Document Control Manager' AND T3.DocumentLevel = 1 AND T3.Status = 2 GROUP BY T1.FirstName, T1.MiddleName, T1.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: Which customer has the highest subtotal amount of sales orders whose assigned to the salesperson with the highest bonus? [/INST] | SELECT T1.CustomerID FROM SalesOrderHeader AS T1 INNER JOIN SalesPerson AS T2 ON T1.SalesPersonID = T2.BusinessEntityID ORDER BY T1.SubTotal 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 price of Sales Order ID 46625 with Volume Discount 11 to 14 and Product ID 716? [/INST] | SELECT T2.UnitPrice * T2.OrderQty FROM SpecialOffer AS T1 INNER JOIN SalesOrderDetail AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID WHERE T1.Description = 'Volume Discount 11 to 14' AND T1.SpecialOfferID = 2 AND T2.ProductID = 716 AND T2.SalesOrderID = 46625; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Of the products that has a reorder inventory point of no more than 600, how many manufactured in-house products that takes 1 day to manufacture with BOM Level 4 are there? [/INST] | SELECT COUNT(T1.ProductID) FROM Product AS T1 INNER JOIN BillOfMaterials AS T2 ON T1.ProductID = T2.ProductAssemblyID WHERE T1.MakeFlag = 1 AND T1.DaysToManufacture = 1 AND T2.BOMLevel = 4 AND T1.ReorderPoint <= 600; |
[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 bonus earned by the sales person in Canada? [/INST] | SELECT T2.Bonus FROM SalesTerritory AS T1 INNER JOIN SalesPerson AS T2 ON T1.TerritoryID = T2.TerritoryID WHERE T1.CountryRegionCode = 'CA' ORDER BY T2.SalesQuota DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What are the names of the product that has the lowest rating? [/INST] | SELECT T2.Name FROM ProductReview AS T1 INNER JOIN Product AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Rating = ( SELECT Rating FROM ProductReview ORDER BY Rating ASC LIMIT 1 ); |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many of the workers who started working in 2009 are from the Production Department? [/INST] | SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID WHERE T2.StartDate >= '2009-01-01' AND T2.StartDate < '2010-01-01' AND T1.Name = '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: Who is the company's highest-paid single female employee? Include her full name and job title. [/INST] | SELECT T3.FirstName, T3.MiddleName, T3.LastName, T1.JobTitle FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Person AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.MaritalStatus = 'S' AND T1.Gender = 'F' 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 Vice President of Engineering and when did he join the company? Indicate his/her full name. [/INST] | SELECT T2.FirstName, T2.MiddleName, T2.LastName, T1.HireDate FROM Employee AS T1 INNER JOIN Person AS T2 USING (BusinessEntityID) WHERE T1.JobTitle = 'Vice President of Engineering'; |
[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 active employees whose payrate is equal or below 30 per hour. [/INST] | SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.CurrentFlag = 1 AND T2.Rate <= 30; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which department has a worker who just recently started working? [/INST] | SELECT T1.Name FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.DepartmentID = T2.DepartmentID ORDER BY T2.StartDate 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 store sales person was reently hired? Indicate his/her full name and gender. [/INST] | SELECT T2.FirstName, T2.MiddleName, T2.LastName, T1.Gender FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.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: How frequently do the employee with the least number of sick leave hours get paid? [/INST] | SELECT T2.PayFrequency FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.SickLeaveHours ASC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Which job title has the lowest pay? [/INST] | SELECT T1.JobTitle FROM Employee AS T1 INNER JOIN EmployeePayHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.Rate ASC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the total number of employees that worked in the Finance department? [/INST] | SELECT COUNT(T2.BusinessEntityID) FROM Department AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 USING (DepartmentID) WHERE T1.Name = 'Finance'; |
[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 the product with the highest list price and of the product with the lowest list price other than 0? Indicates the depth the component is from its parent. [/INST] | SELECT ( SELECT ListPrice - StandardCost FROM Product WHERE ListPrice != 0 ORDER BY ListPrice DESC LIMIT 1 ) , ( SELECT ListPrice - StandardCost FROM Product WHERE ListPrice != 0 ORDER BY ListPrice 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 companies to which Adventure Works Cycles purchases parts or other goods, what is the profit on net obtained from the vendor who has an above average credit rating? Kindly indicate each names of the vendor and the corresponding net profits. [/INST] | SELECT T2.Name, T1.LastReceiptCost - T1.StandardPrice FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CreditRating = 3; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: How many accounts have an address that is too long? [/INST] | SELECT COUNT(*) FROM Address WHERE AddressLine2 <> ''; |
[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 postal code of the street address of the account that is latest updated? [/INST] | SELECT PostalCode FROM Address ORDER BY ModifiedDate 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 longest assembly item duration for bicycles? [/INST] | SELECT JULIANDAY(EndDate) - JULIANDAY(StartDate) FROM BillOfMaterials ORDER BY JULIANDAY(EndDate) - JULIANDAY(StartDate) 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 assembly items for bicycles aren't finished? [/INST] | SELECT COUNT(BillOfMaterialsID) FROM BillOfMaterials WHERE EndDate IS NULL; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the unit measure code of the component that is of the greatest need in quantity to create the assembly. [/INST] | SELECT UnitMeasureCode FROM BillOfMaterials ORDER BY PerAssemblyQty 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 product maintenance documents are private? [/INST] | SELECT COUNT(DocumentNode) FROM Document WHERE DocumentSummary IS NULL; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the titles of the documents that are pending approval. [/INST] | SELECT Title FROM Document WHERE 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: Please list the job titles of the employees who has a document that has been approved. [/INST] | SELECT DISTINCT T2.BusinessEntityID, T2.JobTitle FROM Document AS T1 INNER JOIN Employee AS T2 ON T1.Owner = T2.BusinessEntityID WHERE T1.Status = 2; |
[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 pay frequency of the oldest employee? [/INST] | SELECT T1.PayFrequency FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.BirthDate ASC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the employees whose pay frequencies are the highest, how many of them are married? [/INST] | SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.MaritalStatus = 'M' AND T1.PayFrequency = ( SELECT PayFrequency FROM EmployeePayHistory ORDER BY PayFrequency 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: For the employee who has been hired the latest, what is his or her pay rate? [/INST] | SELECT T1.Rate FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.HireDate 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 employees who have a pay rate of above 40, how many of them are male? [/INST] | SELECT SUM(CASE WHEN T2.Gender = 'M' THEN 1 ELSE 0 END) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Rate > 40; |
[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 pay rate of the employees who are exempt from collective bargaining? [/INST] | SELECT T1.Rate FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.SalariedFlag = 1 ORDER BY T1.Rate DESC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: For the employees who have the highest pay frequency, please list their vacation hours. [/INST] | SELECT T2.VacationHours FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.BusinessEntityID = ( SELECT BusinessEntityID FROM EmployeePayHistory ORDER BY 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: What is the pay rate of the employee who has the longest vacation hours? [/INST] | SELECT T1.Rate FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T2.VacationHours 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 employees with a pay rate of over 35 have more than 10 sick leave hours? [/INST] | SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.SickLeaveHours > 10 AND T1.Rate > 35; |
[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 active male employees, how many of them are paid with the highest frequency? [/INST] | SELECT COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.Gender = 'M' AND T1.PayFrequency = 2; |
[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 male employees have the job position of sales person? [/INST] | SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Gender = 'M' AND T2.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 job position of the oldest employee? [/INST] | SELECT T2.PersonType FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID ORDER BY T1.BirthDate ASC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the name style of the employee with the lowest pay rate? [/INST] | SELECT T2.NameStyle FROM EmployeePayHistory AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Rate IS NOT NULL ORDER BY T1.Rate ASC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the employees who are married, how many of them have a western name style? [/INST] | SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.NameStyle = 0 AND T1.MaritalStatus = '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: Among the employees who have more than 10 hours of sick leave, how many of them wish to receive e-mail promotions? [/INST] | SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 1 AND T1.SickLeaveHours > 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 employees who have more than 20 vacations hours and wish to receive e-mail promotions. [/INST] | SELECT T1.BusinessEntityID FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.EmailPromotion = 1 AND T1.VacationHours > 20; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Please give the additional contact information of the oldest employee with the jod position of sales person. [/INST] | SELECT T2.AdditionalContactInfo FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE PersonType = 'SP' ORDER BY T1.BirthDate ASC LIMIT 1; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the first name of the male employee who has a western name style? [/INST] | SELECT T2.FirstName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.NameStyle = 0 AND T1.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: Among the active employees, how many of them have a courtesy title of "Mr"? [/INST] | SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.CurrentFlag = 1 AND T2.Title = 'Mr.'; |
[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 personal information of the married employee who has the highest pay rate. [/INST] | SELECT T2.Demographics FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmployeePayHistory AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.MaritalStatus = 'M' ORDER BY T3.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: What is the surname suffix of the employee who works as a store contact and has the longest sick leave hours? [/INST] | SELECT T2.Suffix FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.PersonType = 'SP' ORDER BY T1.SickLeaveHours 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 married employees with the highest pay frequency, how many of them have an eastern name style? [/INST] | SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN EmployeePayHistory AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T1.MaritalStatus = 'M' AND T2.NameStyle = 1 AND T3.Rate = ( SELECT Rate FROM EmployeePayHistory ORDER BY 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: How many active employees do not wish to receive e-mail promotions? [/INST] | SELECT COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.CurrentFlag = 1 AND 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: Please list the credit card IDs of the employees who work as store contact. [/INST] | SELECT T2.CreditCardID FROM Person AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.PersonType = 'SC'; |
[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 vacation hours do the male employees have on average? [/INST] | SELECT CAST(SUM(T1.VacationHours) AS REAL) / COUNT(T1.BusinessEntityID) FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.Gender = 'M' AND 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: Among the employees who are married and wish to receive e-mail promotions, how much higher is their highest pay rate from the average pay rate? [/INST] | SELECT MAX(T1.Rate) - SUM(T1.Rate) / COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID INNER JOIN Employee AS T3 ON T2.BusinessEntityID = T3.BusinessEntityID WHERE T2.EmailPromotion = 2 AND T3.MaritalStatus = '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: If a married employee has a western name style, what is the probability of him or her working as a store contact? [/INST] | SELECT CAST(COUNT(IIF(T1.PersonType = 'SC', T1.PersonType, NULL)) AS REAL) / COUNT(T1.PersonType) FROM Person AS T1 INNER JOIN Employee AS T2 WHERE T1.PersonType = 'SC' AND T1.NameStyle = 0 AND T2.MaritalStatus = '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: Among the active employees with over 10 hours of sick leave, what is the percentage of the employees with over 20 vacation hours? [/INST] | SELECT CAST(SUM(CASE WHEN T2.VacationHours > 20 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.BusinessEntityID) FROM EmployeePayHistory AS T1 INNER JOIN Employee AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.CurrentFlag = 1 AND T2.SickLeaveHours > 10; |
[INST] Here is a database schema:
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: Average of the last receipt cost of the products whose average lead time is 60 days. [/INST] | SELECT SUM(LastReceiptCost) / COUNT(ProductID) FROM ProductVendor WHERE AverageLeadTime = 60; |
[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: Average cost of purchase orders made during the first six months of 2012. [/INST] | SELECT CAST(SUM(ActualCost) AS REAL) / COUNT(TransactionID) FROM TransactionHistoryArchive WHERE TransactionType = 'P' AND TransactionDate >= '2012-01-01' AND TransactionDate < '2012-07-01'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What percentage of male employees hired throughout the years 2009 are married? [/INST] | SELECT CAST(SUM(CASE WHEN MaritalStatus = 'M' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(BusinessEntityID) FROM Employee WHERE SUBSTR(HireDate, 1, 4) = '2009' 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 percentage of people named Mary who wants Receive Email promotions of AdventureWorks and selected partners are store contacts? [/INST] | SELECT CAST(SUM(CASE WHEN EmailPromotion = 2 THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN PersonType = 'SC' THEN 1 ELSE 0 END) FROM Person WHERE FirstName = 'Mary'; |
[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, by ProductID, all products whose profit, relative to the standard price, is negative. [/INST] | SELECT DISTINCT ProductID FROM ProductVendor WHERE StandardPrice - LastReceiptCost < 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 average total due price of products with approved status? [/INST] | SELECT SUM(TotalDue) / COUNT(TotalDue) FROM PurchaseOrderHeader WHERE Status = 2; |
[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, by number of sales order units, for orders with quantities not greater than 3 and a discount of 0.2? [/INST] | SELECT CAST(SUM(CASE WHEN OrderQty < 3 AND UnitPriceDiscount = 0.2 THEN 1 ELSE 0 END) AS REAL) / COUNT(SalesOrderID) FROM SalesOrderDetail; |
[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: Lists all companies by BusinessEntityID that increased their current year sales by more than 60% over last year's sales and have a bonus greater than 3,000. [/INST] | SELECT BusinessEntityID FROM SalesPerson WHERE SalesYTD > SalesLastYear + SalesLastyear * 0.6 AND Bonus > 3000; |
[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: Add the number of businesses that indicate their home address as their address and those whose address corresponds to the shipping address. [/INST] | SELECT SUM(CASE WHEN T2.Name = 'Home' THEN 1 ELSE 0 END) , SUM(CASE WHEN T2.Name = 'Shipping' THEN 1 ELSE 0 END) FROM BusinessEntityAddress AS T1 INNER JOIN AddressType AS T2 ON T1.AddressTypeID = T2.AddressTypeID; |
[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: Identifies the ID number of the customer whose sales order for 32 units had a unit price of 35. [/INST] | SELECT T2.CustomerID FROM SalesOrderDetail AS T1 INNER JOIN Customer AS T2 WHERE T1.UnitPrice = 35 AND T1.OrderQty = 32; |
[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 company has a Colonial Voice card that expired in March 2005? [/INST] | SELECT T2.BusinessEntityID FROM CreditCard AS T1 INNER JOIN PersonCreditCard AS T2 ON T1.CreditCardID = T2.CreditCardID WHERE T1.CardType = 'ColonialVoice' AND T1.ExpMonth = 3 AND T1.ExpYear = 2005; |
[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 rating of the company whose average lead time is 16 days for a standard price of 18.9900 and whose last receipt date is August 27, 2011? [/INST] | SELECT T2.CreditRating FROM ProductVendor AS T1 INNER JOIN Vendor AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.StandardPrice = 18.9900 AND T1.AverageLeadTime = 16 AND STRFTIME('%Y-%m-%d', T1.LastReceiptDate) = '2011-08-27'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Calculate the number of products if we add the products of the accessories and components categories. [/INST] | SELECT COUNT(ProductID) FROM Product WHERE Name LIKE '%accessories %' OR Name LIKE '%components%'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the job title of the newest employee in department 12? [/INST] | SELECT T1.JobTitle FROM Employee AS T1 INNER JOIN EmployeeDepartmentHistory AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T2.DepartmentID = 12 ORDER BY T2.StartDate 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 first and last name of all unmarried male Production Supervisors. [/INST] | SELECT T2.FirstName, T2.LastName FROM Employee AS T1 INNER JOIN Person AS T2 ON T1.BusinessEntityID = T2.BusinessEntityID WHERE T1.MaritalStatus = 'S' AND T1.Gender = 'M' AND T1.JobTitle LIKE 'Production Supervisor%'; |
[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 there if we add all those located in the Subassembly category? [/INST] | SELECT COUNT(T1.LocationID) FROM Location AS T1 INNER JOIN ProductInventory AS T2 USING (LocationID) WHERE T1.Name = 'Subassembly'; |
[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: Sum the total number of products rejected for having a trim length that is too long. [/INST] | SELECT SUM(T2.ScrappedQty) FROM ScrapReason AS T1 INNER JOIN WorkOrder AS T2 ON T1.ScrapReasonID = T2.ScrapReasonID WHERE T1.Name = 'Trim length too long'; |
[INST] Here is a database schema:
CountryRegion :
CountryRegionCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Culture :
CultureID [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Currency :
CurrencyCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CountryRegionCurrency :
CountryRegionCode [ TEXT ] CountryRegionCurrency.CountryRegionCode = CountryRegion.CountryRegionCode
CurrencyCode [ TEXT ] CountryRegionCurrency.CurrencyCode = Currency.CurrencyCode
ModifiedDate [ DATETIME ]
Person :
BusinessEntityID [ INTEGER ] primary_key Person.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonType [ TEXT ]
NameStyle [ INTEGER ]
Title [ TEXT ]
FirstName [ TEXT ]
MiddleName [ TEXT ]
LastName [ TEXT ]
Suffix [ TEXT ]
EmailPromotion [ INTEGER ]
AdditionalContactInfo [ TEXT ]
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityContact :
BusinessEntityID [ INTEGER ] BusinessEntityContact.BusinessEntityID = BusinessEntity.BusinessEntityID
PersonID [ INTEGER ] BusinessEntityContact.PersonID = Person.BusinessEntityID
ContactTypeID [ INTEGER ] BusinessEntityContact.ContactTypeID = ContactType.ContactTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
EmailAddress :
BusinessEntityID [ INTEGER ] EmailAddress.BusinessEntityID = Person.BusinessEntityID
EmailAddressID [ INTEGER ]
EmailAddress [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Employee :
BusinessEntityID [ INTEGER ] primary_key Employee.BusinessEntityID = Person.BusinessEntityID
NationalIDNumber [ TEXT ]
LoginID [ TEXT ]
OrganizationNode [ TEXT ]
OrganizationLevel [ INTEGER ]
JobTitle [ TEXT ]
BirthDate [ DATE ]
MaritalStatus [ TEXT ]
Gender [ TEXT ]
HireDate [ DATE ]
SalariedFlag [ INTEGER ]
VacationHours [ INTEGER ]
SickLeaveHours [ INTEGER ]
CurrentFlag [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Password :
BusinessEntityID [ INTEGER ] primary_key Password.BusinessEntityID = Person.BusinessEntityID
PasswordHash [ TEXT ]
PasswordSalt [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
PersonCreditCard :
BusinessEntityID [ INTEGER ] PersonCreditCard.BusinessEntityID = Person.BusinessEntityID
CreditCardID [ INTEGER ] PersonCreditCard.CreditCardID = CreditCard.CreditCardID
ModifiedDate [ DATETIME ]
ProductCategory :
ProductCategoryID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductDescription :
ProductDescriptionID [ INTEGER ] primary_key
Description [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModel :
ProductModelID [ INTEGER ] primary_key
Name [ TEXT ]
CatalogDescription [ TEXT ]
Instructions [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductModelProductDescriptionCulture :
ProductModelID [ INTEGER ] ProductModelProductDescriptionCulture.ProductModelID = ProductModel.ProductModelID
ProductDescriptionID [ INTEGER ] ProductModelProductDescriptionCulture.ProductDescriptionID = ProductDescription.ProductDescriptionID
CultureID [ TEXT ] ProductModelProductDescriptionCulture.CultureID = Culture.CultureID
ModifiedDate [ DATETIME ]
ProductPhoto :
ProductPhotoID [ INTEGER ] primary_key
ThumbNailPhoto [ BLOB ]
ThumbnailPhotoFileName [ TEXT ]
LargePhoto [ BLOB ]
LargePhotoFileName [ TEXT ]
ModifiedDate [ DATETIME ]
ProductSubcategory :
ProductSubcategoryID [ INTEGER ] primary_key
ProductCategoryID [ INTEGER ] ProductSubcategory.ProductCategoryID = ProductCategory.ProductCategoryID
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesReason :
SalesReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ReasonType [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritory :
TerritoryID [ INTEGER ] primary_key
Name [ TEXT ]
CountryRegionCode [ TEXT ] SalesTerritory.CountryRegionCode = CountryRegion.CountryRegionCode
Group [ TEXT ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
CostYTD [ REAL ]
CostLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPerson :
BusinessEntityID [ INTEGER ] primary_key SalesPerson.BusinessEntityID = Employee.BusinessEntityID
TerritoryID [ INTEGER ] SalesPerson.TerritoryID = SalesTerritory.TerritoryID
SalesQuota [ REAL ]
Bonus [ REAL ]
CommissionPct [ REAL ]
SalesYTD [ REAL ]
SalesLastYear [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesPersonQuotaHistory :
BusinessEntityID [ INTEGER ] SalesPersonQuotaHistory.BusinessEntityID = SalesPerson.BusinessEntityID
QuotaDate [ DATETIME ]
SalesQuota [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTerritoryHistory :
BusinessEntityID [ INTEGER ] SalesTerritoryHistory.BusinessEntityID = SalesPerson.BusinessEntityID
TerritoryID [ INTEGER ] SalesTerritoryHistory.TerritoryID = SalesTerritory.TerritoryID
StartDate [ DATETIME ]
EndDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ScrapReason :
ScrapReasonID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Shift :
ShiftID [ INTEGER ] primary_key
Name [ TEXT ]
StartTime [ TEXT ]
EndTime [ TEXT ]
ModifiedDate [ DATETIME ]
ShipMethod :
ShipMethodID [ INTEGER ] primary_key
Name [ TEXT ]
ShipBase [ REAL ]
ShipRate [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SpecialOffer :
SpecialOfferID [ INTEGER ] primary_key
Description [ TEXT ]
DiscountPct [ REAL ]
Type [ TEXT ]
Category [ TEXT ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
MinQty [ INTEGER ]
MaxQty [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BusinessEntityAddress :
BusinessEntityID [ INTEGER ] BusinessEntityAddress.BusinessEntityID = BusinessEntity.BusinessEntityID
AddressID [ INTEGER ] BusinessEntityAddress.AddressID = Address.AddressID
AddressTypeID [ INTEGER ] BusinessEntityAddress.AddressTypeID = AddressType.AddressTypeID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesTaxRate :
SalesTaxRateID [ INTEGER ] primary_key
StateProvinceID [ INTEGER ] SalesTaxRate.StateProvinceID = StateProvince.StateProvinceID
TaxType [ INTEGER ]
TaxRate [ REAL ]
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Store :
BusinessEntityID [ INTEGER ] primary_key Store.BusinessEntityID = BusinessEntity.BusinessEntityID
Name [ TEXT ]
SalesPersonID [ INTEGER ] Store.SalesPersonID = SalesPerson.BusinessEntityID
Demographics [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderHeaderSalesReason :
SalesOrderID [ INTEGER ] SalesOrderHeaderSalesReason.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesReasonID [ INTEGER ] SalesOrderHeaderSalesReason.SalesReasonID = SalesReason.SalesReasonID
ModifiedDate [ DATETIME ]
TransactionHistoryArchive :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ]
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
UnitMeasure :
UnitMeasureCode [ TEXT ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
ProductCostHistory :
ProductID [ INTEGER ] ProductCostHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
StandardCost [ REAL ]
ModifiedDate [ DATETIME ]
ProductDocument :
ProductID [ INTEGER ] ProductDocument.ProductID = Product.ProductID
DocumentNode [ TEXT ] ProductDocument.DocumentNode = Document.DocumentNode
ModifiedDate [ DATETIME ]
ProductInventory :
ProductID [ INTEGER ] ProductInventory.ProductID = Product.ProductID
LocationID [ INTEGER ] ProductInventory.LocationID = Location.LocationID
Shelf [ TEXT ]
Bin [ INTEGER ]
Quantity [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductProductPhoto :
ProductID [ INTEGER ] ProductProductPhoto.ProductID = Product.ProductID
ProductPhotoID [ INTEGER ] ProductProductPhoto.ProductPhotoID = ProductPhoto.ProductPhotoID
Primary [ INTEGER ]
ModifiedDate [ DATETIME ]
ProductReview :
ProductReviewID [ INTEGER ] primary_key
ProductID [ INTEGER ] ProductReview.ProductID = Product.ProductID
ReviewerName [ TEXT ]
ReviewDate [ DATETIME ]
EmailAddress [ TEXT ]
Rating [ INTEGER ]
Comments [ TEXT ]
ModifiedDate [ DATETIME ]
ShoppingCartItem :
ShoppingCartItemID [ INTEGER ] primary_key
ShoppingCartID [ TEXT ]
Quantity [ INTEGER ]
ProductID [ INTEGER ] ShoppingCartItem.ProductID = Product.ProductID
DateCreated [ DATETIME ]
ModifiedDate [ DATETIME ]
SpecialOfferProduct :
SpecialOfferID [ INTEGER ] SpecialOfferProduct.SpecialOfferID = SpecialOffer.SpecialOfferID
ProductID [ INTEGER ] SpecialOfferProduct.ProductID = Product.ProductID
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
SalesOrderDetail :
SalesOrderID [ INTEGER ] SalesOrderDetail.SalesOrderID = SalesOrderHeader.SalesOrderID
SalesOrderDetailID [ INTEGER ] primary_key
CarrierTrackingNumber [ TEXT ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] SalesOrderDetail.ProductID = SpecialOfferProduct.ProductID
SpecialOfferID [ INTEGER ] SalesOrderDetail.SpecialOfferID = SpecialOfferProduct.SpecialOfferID
UnitPrice [ REAL ]
UnitPriceDiscount [ REAL ]
LineTotal [ REAL ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
TransactionHistory :
TransactionID [ INTEGER ] primary_key
ProductID [ INTEGER ] TransactionHistory.ProductID = Product.ProductID
ReferenceOrderID [ INTEGER ]
ReferenceOrderLineID [ INTEGER ]
TransactionDate [ DATETIME ]
TransactionType [ TEXT ]
Quantity [ INTEGER ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Vendor :
BusinessEntityID [ INTEGER ] primary_key Vendor.BusinessEntityID = BusinessEntity.BusinessEntityID
AccountNumber [ TEXT ]
Name [ TEXT ]
CreditRating [ INTEGER ]
PreferredVendorStatus [ INTEGER ]
ActiveFlag [ INTEGER ]
PurchasingWebServiceURL [ TEXT ]
ModifiedDate [ DATETIME ]
ProductVendor :
ProductID [ INTEGER ] ProductVendor.ProductID = Product.ProductID
BusinessEntityID [ INTEGER ] ProductVendor.BusinessEntityID = Vendor.BusinessEntityID
AverageLeadTime [ INTEGER ]
StandardPrice [ REAL ]
LastReceiptCost [ REAL ]
LastReceiptDate [ DATETIME ]
MinOrderQty [ INTEGER ]
MaxOrderQty [ INTEGER ]
OnOrderQty [ INTEGER ]
UnitMeasureCode [ TEXT ] ProductVendor.UnitMeasureCode = UnitMeasure.UnitMeasureCode
ModifiedDate [ DATETIME ]
PurchaseOrderHeader :
PurchaseOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
Status [ INTEGER ]
EmployeeID [ INTEGER ] PurchaseOrderHeader.EmployeeID = Employee.BusinessEntityID
VendorID [ INTEGER ] PurchaseOrderHeader.VendorID = Vendor.BusinessEntityID
ShipMethodID [ INTEGER ] PurchaseOrderHeader.ShipMethodID = ShipMethod.ShipMethodID
OrderDate [ DATETIME ]
ShipDate [ DATETIME ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
ModifiedDate [ DATETIME ]
PurchaseOrderDetail :
PurchaseOrderID [ INTEGER ] PurchaseOrderDetail.PurchaseOrderID = PurchaseOrderHeader.PurchaseOrderID
PurchaseOrderDetailID [ INTEGER ] primary_key
DueDate [ DATETIME ]
OrderQty [ INTEGER ]
ProductID [ INTEGER ] PurchaseOrderDetail.ProductID = Product.ProductID
UnitPrice [ REAL ]
LineTotal [ REAL ]
ReceivedQty [ REAL ]
RejectedQty [ REAL ]
StockedQty [ REAL ]
ModifiedDate [ DATETIME ]
WorkOrder :
WorkOrderID [ INTEGER ] primary_key
ProductID [ INTEGER ] WorkOrder.ProductID = Product.ProductID
OrderQty [ INTEGER ]
StockedQty [ INTEGER ]
ScrappedQty [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
DueDate [ DATETIME ]
ScrapReasonID [ INTEGER ] WorkOrder.ScrapReasonID = ScrapReason.ScrapReasonID
ModifiedDate [ DATETIME ]
WorkOrderRouting :
WorkOrderID [ INTEGER ] WorkOrderRouting.WorkOrderID = WorkOrder.WorkOrderID
ProductID [ INTEGER ]
OperationSequence [ INTEGER ]
LocationID [ INTEGER ] WorkOrderRouting.LocationID = Location.LocationID
ScheduledStartDate [ DATETIME ]
ScheduledEndDate [ DATETIME ]
ActualStartDate [ DATETIME ]
ActualEndDate [ DATETIME ]
ActualResourceHrs [ REAL ]
PlannedCost [ REAL ]
ActualCost [ REAL ]
ModifiedDate [ DATETIME ]
Customer :
CustomerID [ INTEGER ] primary_key
PersonID [ INTEGER ] Customer.PersonID = Person.BusinessEntityID
StoreID [ INTEGER ] Customer.StoreID = Store.BusinessEntityID
TerritoryID [ INTEGER ] Customer.TerritoryID = SalesTerritory.TerritoryID
AccountNumber [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ProductListPriceHistory :
ProductID [ INTEGER ] ProductListPriceHistory.ProductID = Product.ProductID
StartDate [ DATE ]
EndDate [ DATE ]
ListPrice [ REAL ]
ModifiedDate [ DATETIME ]
Address :
AddressID [ INTEGER ] primary_key
AddressLine1 [ TEXT ]
AddressLine2 [ TEXT ]
City [ TEXT ]
StateProvinceID [ INTEGER ]
PostalCode [ TEXT ]
SpatialLocation [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
AddressType :
AddressTypeID [ INTEGER ] primary_key
Name [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
BillOfMaterials :
BillOfMaterialsID [ INTEGER ] primary_key
ProductAssemblyID [ INTEGER ]
ComponentID [ INTEGER ]
StartDate [ DATETIME ]
EndDate [ DATETIME ]
UnitMeasureCode [ TEXT ]
BOMLevel [ INTEGER ]
PerAssemblyQty [ REAL ]
ModifiedDate [ DATETIME ]
BusinessEntity :
BusinessEntityID [ INTEGER ] primary_key
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
ContactType :
ContactTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
CurrencyRate :
CurrencyRateID [ INTEGER ] primary_key
CurrencyRateDate [ DATETIME ]
FromCurrencyCode [ TEXT ]
ToCurrencyCode [ TEXT ]
AverageRate [ REAL ]
EndOfDayRate [ REAL ]
ModifiedDate [ DATETIME ]
Department :
DepartmentID [ INTEGER ] primary_key
Name [ TEXT ]
GroupName [ TEXT ]
ModifiedDate [ DATETIME ]
EmployeeDepartmentHistory :
BusinessEntityID [ INTEGER ]
DepartmentID [ INTEGER ]
ShiftID [ INTEGER ]
StartDate [ DATE ]
EndDate [ DATE ]
ModifiedDate [ DATETIME ]
EmployeePayHistory :
BusinessEntityID [ INTEGER ]
RateChangeDate [ DATETIME ]
Rate [ REAL ]
PayFrequency [ INTEGER ]
ModifiedDate [ DATETIME ]
JobCandidate :
JobCandidateID [ INTEGER ] primary_key
BusinessEntityID [ INTEGER ]
Resume [ TEXT ]
ModifiedDate [ DATETIME ]
Location :
LocationID [ INTEGER ] primary_key
Name [ TEXT ]
CostRate [ REAL ]
Availability [ REAL ]
ModifiedDate [ DATETIME ]
PhoneNumberType :
PhoneNumberTypeID [ INTEGER ] primary_key
Name [ TEXT ]
ModifiedDate [ DATETIME ]
Product :
ProductID [ INTEGER ] primary_key
Name [ TEXT ]
ProductNumber [ TEXT ]
MakeFlag [ INTEGER ]
FinishedGoodsFlag [ INTEGER ]
Color [ TEXT ]
SafetyStockLevel [ INTEGER ]
ReorderPoint [ INTEGER ]
StandardCost [ REAL ]
ListPrice [ REAL ]
Size [ TEXT ]
SizeUnitMeasureCode [ TEXT ]
WeightUnitMeasureCode [ TEXT ]
Weight [ REAL ]
DaysToManufacture [ INTEGER ]
ProductLine [ TEXT ]
Class [ TEXT ]
Style [ TEXT ]
ProductSubcategoryID [ INTEGER ]
ProductModelID [ INTEGER ]
SellStartDate [ DATETIME ]
SellEndDate [ DATETIME ]
DiscontinuedDate [ DATETIME ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Document :
DocumentNode [ TEXT ] primary_key
DocumentLevel [ INTEGER ]
Title [ TEXT ]
Owner [ INTEGER ]
FolderFlag [ INTEGER ]
FileName [ TEXT ]
FileExtension [ TEXT ]
Revision [ TEXT ]
ChangeNumber [ INTEGER ]
Status [ INTEGER ]
DocumentSummary [ TEXT ]
Document [ BLOB ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
StateProvince :
StateProvinceID [ INTEGER ] primary_key
StateProvinceCode [ TEXT ]
CountryRegionCode [ TEXT ]
IsOnlyStateProvinceFlag [ INTEGER ]
Name [ TEXT ]
TerritoryID [ INTEGER ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
CreditCard :
CreditCardID [ INTEGER ] primary_key
CardType [ TEXT ]
CardNumber [ TEXT ]
ExpMonth [ INTEGER ]
ExpYear [ INTEGER ]
ModifiedDate [ DATETIME ]
SalesOrderHeader :
SalesOrderID [ INTEGER ] primary_key
RevisionNumber [ INTEGER ]
OrderDate [ DATETIME ]
DueDate [ DATETIME ]
ShipDate [ DATETIME ]
Status [ INTEGER ]
OnlineOrderFlag [ INTEGER ]
SalesOrderNumber [ TEXT ]
PurchaseOrderNumber [ TEXT ]
AccountNumber [ TEXT ]
CustomerID [ INTEGER ]
SalesPersonID [ INTEGER ]
TerritoryID [ INTEGER ]
BillToAddressID [ INTEGER ]
ShipToAddressID [ INTEGER ]
ShipMethodID [ INTEGER ]
CreditCardID [ INTEGER ]
CreditCardApprovalCode [ TEXT ]
CurrencyRateID [ INTEGER ]
SubTotal [ REAL ]
TaxAmt [ REAL ]
Freight [ REAL ]
TotalDue [ REAL ]
Comment [ TEXT ]
rowguid [ TEXT ]
ModifiedDate [ DATETIME ]
Please write me a SQL statement that answers the following question: Calculate the total quantity of purchased product that has been prepared by employee number 257 and is in pending shipment status. [/INST] | SELECT SUM(T2.OrderQty) FROM PurchaseOrderHeader AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.PurchaseOrderID = T2.PurchaseOrderID 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: If we discount the products that do not have any type of offer, how many different products have been sold in an amount greater than 2 units per order? [/INST] | SELECT COUNT(DISTINCT T1.ProductID) FROM SalesOrderDetail AS T1 INNER JOIN SpecialOfferProduct AS T2 ON T1.SpecialOfferID = T2.SpecialOfferID INNER JOIN SpecialOffer AS T3 ON T2.SpecialOfferID = T3.SpecialOfferID WHERE T1.OrderQty > 2 AND T1.UnitPriceDiscount = 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 type of transaction was made with the only yellow product, size 62 and with a minimum inventory stock of 500 units? [/INST] | SELECT DISTINCT T2.TransactionType FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Size = 62 AND T1.Color = 'Yellow' AND T1.SafetyStockLevel = 500; |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.